require File.expand_path(File.dirname(__FILE__) + "/../spec_helper") describe "within" do it "should work when nested" do with_html <<-HTML
HTML webrat_session.should_receive(:get).with("/page2", {}) within "#container" do within "div" do click_link "Link" end end end it "should click links within a scope" do with_html <<-HTML Link HTML webrat_session.should_receive(:get).with("/page2", {}) within "#container" do click_link "Link" end end it "should submit forms within a scope" do with_html <<-HTML HTML webrat_session.should_receive(:get).with("/form2", "email" => "test@example.com") within "#form2" do fill_in "Email", :with => "test@example.com" click_button end end it "should work when the scope is inside the form" do with_html <<-HTML HTML webrat_session.should_receive(:get).with("/form2", "email" => "test@example.com") within ".important" do fill_in "Email", :with => "test@example.com" end submit_form "form2" end it "should work when the form submission occurs inside a scope" do with_html <<-HTML