Tag: capybara bdd

如何使用Capybara和RSpec检查会话哈希?

在Stack Overflow上找到关于此的各种post,但没有找到解决方案。 在集成测试中,如何使用Capybara和RSpec检查会话哈希? puts session.inspect undefined method for nil错误抛出一个undefined method for nil 。

Capybara和之前(:全部)在rspec

这是我的完整规范: require ‘spec_helper’ describe “Idea page”, js: true do subject { page } before(:all) do create(:idea) visit root_path click_link “Log In” end context “Single idea” do before do page.find(:xpath, ‘//*[@id=”accordion”]/div/div[1]/a’).click end it { should have_selector(‘a’,text:’Claim’) } it “should have a button for reporting the idea” it “should have a button for opening all links” describe […]

Capybara :: ElementNotFound,但它就在那里

我收到以下错误: Capybara::ElementNotFound: Unable to find field “username” ./spec/controllers/sessions_controller_spec.rb:10:in `block (3 levels) in ‘ 规格: require ‘spec_helper’ describe SessionsController do before :each do @user = FactoryGirl.create(:user) end context ‘creating a new session’ do it ‘can set the current_user variable to the logged user’ do visit ‘/login’ fill_in ‘username’, with: ‘gabrielhilal’ #I have tried `Username` as well […]

Rails Rspec错误 – 未定义的方法`访问’

所以我是TDD的新手,我在我的测试中抛出一些Rspec错误…基本上在运行bundle exec rspec spec之后,我得到一些undefined method ‘visit’错误我的一些规范。 任何有关如何通过这些测试的帮助将非常感激:谢谢。 Failures: 1) User pages profile page Failure/Error: before { visit user_path(user) } NoMethodError: undefined method `visit’ for # # ./spec/requests/user_pages_spec.rb:9:in `block (3 levels) in ‘ 2) User pages profile page Failure/Error: before { visit user_path(user) } NoMethodError: undefined method `visit’ for # # ./spec/requests/user_pages_spec.rb:9:in `block (3 levels) in […]