Skip to content

Commit

Permalink
VCR com metadados RSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackson Pires authored and Jackson Pires committed Nov 19, 2017
1 parent 675787a commit 7ee47d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test_app/spec/httparty/httparty_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
describe 'HTTParty' do
it 'content-type' do
it 'content-type', vcr: { cassette_name: 'jsonplaceholder/posts'} do
#stub_request(:get, "https://jsonplaceholder.typicode.com/posts/2").
# to_return(status: 200, body: "", headers: { 'content-type': 'application/json'})

VCR.use_cassette("jsonplaceholder/posts") do
response = HTTParty.get('https://jsonplaceholder.typicode.com/posts/2')
content_type = response.headers['content-type']
expect(content_type).to match(/application\/json/)
end
response = HTTParty.get('https://jsonplaceholder.typicode.com/posts/2')
content_type = response.headers['content-type']
expect(content_type).to match(/application\/json/)
end
end
1 change: 1 addition & 0 deletions test_app/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
VCR.configure do |config|
config.cassette_library_dir = "spec/fixtures/vcr_cassettes"
config.hook_into :webmock
config.configure_rspec_metadata!
end

# This file was generated by the `rails generate rspec:install` command. Conventionally, all
Expand Down

0 comments on commit 7ee47d9

Please sign in to comment.