私は RSpec のスキルに取り組んでいる Rails の初心者です。この未定義のエラーが発生し、頭を悩ませています。ここにあります:
1) Veiwing the list of movies shows the movies
Failure/Error: expect(page).to have_text(Movies.location)
NoMethodError:
undefined method `location' for #<Class:0x00000104bbb958>
# ./spec/features/list_movies_spec.rb:26:in `block (2 levels) in <top (required)>
以下は私のスペックファイルです。ここで私が見落としていることを教えてください。
require "spec_helper"
feature "Veiwing the list of movies" do
it "shows the movies" do
movie1 = Movies.create(name: "The Butler", location: "New York City",
price:15.00)
movie2 = Movies.create(name: "The Grand Master", location: "New Jersey",
price:15.00)
movie3 = Movies.create(name: "Elysium", location: "Los Angeles",
price:15.00 )
movie4 = Movies.create(name:"Pacific Rim", location: "Queens NY",
price:15.00)
visit movies_url
expect(page).to have_text("4 Movies")
expect(page).to have_text(Movies.name)
expect(page).to have_text(Movies.name)
expect(page).to have_text(Movies.name)
expect(page).to have_text(Movies.name)
expect(page).to have_text(Movies.location)
expect(page).to have_text(Movies.description)
expect(page).to have_text("15.00")
end
end