I'm running a simple test to list an objects attributes.
require 'spec_helper'
describe 'List Movies' do
it 'Lists all movies' do
movie1 = Movie.create(
title: "Iron Man",
rating: "PG-13",
total_gross: 10000000
)
movie2 = Movie.create(
title: "Super Man",
rating: "PG",
total_gross: 120000000
)
movie3 = Movie.create(
title: "Spider Man",
rating: "R-16",
total_gross: 30000000
)
visit movies_url
expect(page).to have_text("3 Movies")
expect(page).to have_text(movie1.title)
expect(page).to have_text(movie2.title)
expect(page).to have_text(movie3.title)
expect(page).to have_text(movie1.title)
expect(page).to have_text(movie1.rating)
expect(page).to have_text("10000000")
end
end
It comes back to me with uninitialized constant Movie.
so i run a generator.
rails g model Movie title:string rating:string total_gross:decimal --no-test-framework.
I run the test again, rspec spec/features/list_movies_spec.rb.
Yet, still the same error, i've done this a hundred times before, why is it not recognizing the model after running the generator?.