我正在尝试使用集成测试来建立我的ember-cli/rails应用程序。在折腾了Ember内置的测试库后,我转而使用RSpec(我本来就用于后端),以及Capybara。尽管现在我可以正确填写表单,但我的登录请求总是失败。我认为问题出在Capybara将请求发送到了不同的数据库环境或其他地方!如果我在rails控制台中检查,用户肯定存在,并且在RSpec测试的过程中我也创建了一个用户。
有人成功设置过Ember/Rails/Capybara/RSpec吗?
这是我的spec:
有人成功设置过Ember/Rails/Capybara/RSpec吗?
这是我的spec:
describe "the signin process", :type => :feature, :js => true do
it "signs me in" do
visit '/'
FactoryGirl.create :user, email: "user@example.com", password: 'password'
within("#tufts-nav") do
fill_in 'email', :with => 'test@test.com'
fill_in 'password', :with => 'password'
end
click_button 'Sign In'
# here authentication fails mysteriously
expect(page).to have_content 'Jobs'
end
end
rails_helper.rb
中错误配置了DatabaseCleaner。 - Ryan