Created
September 24, 2013 23:50
-
-
Save bwiggs/6692978 to your computer and use it in GitHub Desktop.
This was how I solved mocking the request object for a Draper decorator from RSpec.
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
describe 'ArticleDecorator' | |
describe '#opengraph_image_url' do | |
it 'should provide the default image as a fallback' do | |
request = stub(host: 'local.example.com', port: 3000) | |
ArticleDecorator.any_instance.stub request: request | |
ArticleDecorator.new(Article.new).opengraph_image_url.should == "http://local.example.com:3000/images/default.png" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment