Created
January 30, 2015 04:43
-
-
Save ridget/e842a77ca38da9bfb02e to your computer and use it in GitHub Desktop.
view spec sample
This file contains 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
# spec/views/products/_product.html.erb_spec.rb | |
describe 'products/_product.html.erb' do | |
context 'when the product has a url' do | |
it 'displays the url' do | |
assign(:product, build(:product, url: 'http://example.com') | |
render | |
expect(rendered).to have_link 'Product', href: 'http://example.com' | |
end | |
end | |
context 'when the product url is nil' do | |
it "displays 'None'" do | |
assign(:product, build(:product, url: nil) | |
render | |
expect(rendered).to have_content 'None' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment