Created
May 8, 2018 09:16
-
-
Save stevo/34713c75b5ec9a54ee777efa0725910f to your computer and use it in GitHub Desktop.
An opinionated guide to readable RSpec (part 2 of 2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allow(OMDBClient).to receive(:get_movie) { | |
{ | |
"Title" => "The Rock", | |
"Year" => "1996", | |
"Rated" => "R", | |
"Released" => "07 Jun 1996", | |
"Runtime" => "136 min", | |
"Genre" => "Action, Adventure, Thriller" | |
} | |
} | |
result = OMDBWrapper.get_movie_by_title('The Rock') | |
expect(result).to be_a_kind_of(Movie).and(have_attributes(title: 'The Rock', year: 1996)) | |
expect(OMDBClient).to have_received(:get_movie).with(t: 'The Rock') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment