Skip to content

Instantly share code, notes, and snippets.

@alanmaciel
Created February 26, 2018 04:17
Show Gist options
  • Save alanmaciel/5b3fa189f86ca2d9be6bd8221959b2f0 to your computer and use it in GitHub Desktop.
Save alanmaciel/5b3fa189f86ca2d9be6bd8221959b2f0 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe "Viewing an individual movie" do
it "shows the movie's details" do
movie = Movie.create(movie_attributes)
visit movie_url(movie)
expect(page).to have_text(movie.title)
expect(page).to have_text(movie.rating)
expect(page).to have_text(movie.description)
expect(page).to have_text(movie.released_on)
expect(page).to have_text(movie.cast)
expect(page).to have_text(movie.director)
expect(page).to have_text(movie.duration)
expect(page).to have_selector("img[src$='#{movie.image_file_name}']")
end
it "shows the total gross if the total gross exceeds $50M" do
movie = Movie.create(movie_attributes(total_gross: 60000000))
visit movie_url(movie)
expect(page).to have_text("$60,000,000.00")
end
it "shows 'Flop!' if the total gross is less than $50M" do
movie = Movie.create(movie_attributes(total_gross: 40000000))
visit movie_url(movie)
expect(page).to have_text("Flop!")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment