Skip to content

Commit

Permalink
Modos de gravação do VCR
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 4cd18c4 commit e7fc2cb
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 2 deletions.
128 changes: 128 additions & 0 deletions test_app/spec/fixtures/vcr_cassettes/jsonplaceholder/posts.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions test_app/spec/httparty/httparty_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
describe 'HTTParty' do
it 'content-type', vcr: { cassette_name: 'jsonplaceholder/posts', match_requests_on: [:body]} do
#it 'content-type', vcr: { cassette_name: 'jsonplaceholder/posts', match_requests_on: [:body]} do
it 'content-type', vcr: { cassette_name: 'jsonplaceholder/posts', :record => :new_episodes } do
#stub_request(:get, "https://jsonplaceholder.typicode.com/posts/2").
# to_return(status: 200, body: "", headers: { 'content-type': 'application/json'})

response = HTTParty.get("https://jsonplaceholder.typicode.com/posts/#{[1,2,3,4,5].sample}")
response = HTTParty.get("https://jsonplaceholder.typicode.com/posts/3")
content_type = response.headers['content-type']
expect(content_type).to match(/application\/json/)
end
Expand Down

0 comments on commit e7fc2cb

Please sign in to comment.