我决定使用新的 Rspec 3 (+ capybara/factory_girl) 开始一个新项目,但在学习新语法时遇到了麻烦。现在我有
user_pages_spec.rb(功能)
scenario "Signing Up" do
let(:submit) { "Sign up" }
scenario "With valid information" do
background do
fill_in "Username", with: "example"
fill_in "Email", with: "example@example.com"
fill_in "Password", with: "foobar123"
fill_in "Password confirmation", with: "foobar123"
end
scenario "should create a user" do
expect { click_button submit }.to change(User, :count).by(1)
end
end
end
由于未定义的方法“让”而失败。和:
static_pages_spec.rb(控制器)
describe StaticPagesController do
describe "GET 'home'" do
it "returns http success" do
get :home
expect(response).to be_success
end
end
end
带有“未定义的方法'get'。(这只是默认的控制器规范)