Patrick J. Collins
2012-May-09 20:09 UTC
[rspec-users] is there a way to turn on :js => true in the middle of a spec?
Hi, If I have a spec with some complicated background stuff-- like say for example logging in... it "does stuff", :js => true do fancy_login_helper_method visit somewhere_over_the_rainbow_path click_button "omg" page.should have_content("waka waka") end ... Is there any way to do something like : it "does stuff" do fancy_login_helper_method js do visit somewhere_over_the_rainbow_path click_button "omg" page.should have_content("waka waka") end end So that I can cut down the time it takes to excute that test a bit? Or is that just impossible with the way headless vs browser stuff works? Patrick J. Collins http://collinatorstudios.com
David Chelimsky
2012-May-09 20:44 UTC
[rspec-users] is there a way to turn on :js => true in the middle of a spec?
On Wed, May 9, 2012 at 3:09 PM, Patrick J. Collins <patrick at collinatorstudios.com> wrote:> Hi, > > If I have a spec with some complicated background stuff-- ?like say for > example logging in... > > it "does stuff", :js => true do > ?fancy_login_helper_method > ?visit somewhere_over_the_rainbow_path > ?click_button "omg" > ?page.should have_content("waka waka") > end > > ... ?Is there any way to do something like : > > it "does stuff" do > ?fancy_login_helper_method > ?js do > ? ?visit somewhere_over_the_rainbow_path > ? ?click_button "omg" > ? ?page.should have_content("waka waka") > ?end > end > > So that I can cut down the time it takes to excute that test a bit? ?Or > is that just impossible with the way headless vs browser stuff works?iiuc, browser is the issue, not headless. The login token/cookie/whatever needs to be stored in the client so it can identify itself to the server. What your proposing switches the client.