December 2014
Intermediate to advanced
350 pages
8h 43m
English
The adapter tests work between the adapter and the server, using VCR as a medium:
| external/02/gatherer/spec/models/avatar_adapter_spec.rb | |
| | require 'rails_helper' |
| | |
| | describe AvatarAdapter do |
| | it "accurately receives image url", :vcr do |
| | user = double(twitter_handle: "noelrap") |
| | adapter = AvatarAdapter.new(user) |
| | url = "http://pbs.twimg.com/profile_images/40008602/head_shot_bigger.jpg" |
| | expect(adapter.image_url).to eq(url) |
| | end |
| | end |
This test has no dependency on the client, which we show by passing in a double rather than an actual User instance. Using a VCR cassette, we create a new adapter and assert that the adapter provides the expected URL when queried. The test also doesn’t have a particular dependency ...
Read now
Unlock full access