Adapter Tests
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 ...
Get Rails 4 Test Prescriptions now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.