Capybara and before(:all) in rspec
问题 Here's my complete spec: 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 "Claiming" do before do click_link "Claim" end it {should have_selector('a',