Sha256: 00192661f28c30e6b9fbfeb54232ac4abf36c5c310a95d84159d5835e317e4ff

Contents?: true

Size: 804 Bytes

Versions: 7

Compression:

Stored size: 804 Bytes

Contents

Capybara::SpecHelper.spec '#current_scope' do
  before do
    @session.visit('/with_scope')
  end
  
  context "when not in a #within block" do
    it "should return the document" do
      @session.current_scope.should be_kind_of Capybara::Node::Document
    end
  end
  
  context "when in a #within block" do
    it "should return the element in scope" do
      @session.within(:css, "#simple_first_name") do
        @session.current_scope[:name].should eq 'first_name'
      end
    end
  end
  
  context "when in a nested #within block" do
    it "should return the element in scope" do
      @session.within("//div[@id='for_bar']") do
        @session.within(".//input[@value='Peter']") do
          @session.current_scope[:name].should eq 'form[first_name]'
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
capybara-2.2.1 lib/capybara/spec/session/current_scope_spec.rb
capybara-2.2.0 lib/capybara/spec/session/current_scope_spec.rb
capybara-2.2.0.rc1 lib/capybara/spec/session/current_scope_spec.rb
swipe-rails-0.0.5 vendor/bundle/gems/capybara-2.1.0/lib/capybara/spec/session/current_scope_spec.rb
capybara-2.1.0 lib/capybara/spec/session/current_scope_spec.rb
capybara-2.1.0.rc1 lib/capybara/spec/session/current_scope_spec.rb
capybara-2.1.0.beta1 lib/capybara/spec/session/current_scope_spec.rb