spec/webmock_helpers.rb in softcover-1.5.10 vs spec/webmock_helpers.rb in softcover-1.5.11
- old
+ new
@@ -7,27 +7,27 @@
def test_access_key; 'asdf' end
def test_id; 1 end
def headers(with_content_length=true)
hash = { 'Accept'=>'application/json',
- 'Accept-Encoding'=>'gzip, deflate',
+ 'Accept-Encoding'=>/.+/,
'Content-Type'=>'application/json',
- 'User-Agent'=>'Ruby'
+ 'User-Agent'=>/.+/
}
hash['Content-Length'] = /.+/ if with_content_length
hash
end
def stub_valid_login(email, pass, api_key=TEST_API_KEY)
stub_request(:post, "#{api_base_url}/login").
- with(:body => { "email" => email, "password" => pass },
+ with(:body => { "email" => email, "password" => pass }.to_json,
:headers => headers ).
to_return(:status => 200, :body => {api_key: api_key}.to_json)
end
def stub_invalid_login(email, pass)
stub_request(:post, "#{api_base_url}/login").
- with(:body => { "email" => email, "password" => pass },
+ with(:body => { "email" => email, "password" => pass }.to_json,
:headers => headers ).
to_return(:status => 422, body: '')
end
def stub_create_book(book)