Sha256: b71c48763a9996c65d9ba10e6d3dc4d7fe7526150381a34b56d5c5249188f3e1

Contents?: true

Size: 842 Bytes

Versions: 13

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

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
      expect(@session.current_scope).to 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
        expect(@session.current_scope[:name]).to 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
          expect(@session.current_scope[:name]).to eq 'form[first_name]'
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
tdiary-5.0.9 vendor/bundle/gems/capybara-3.2.1/lib/capybara/spec/session/current_scope_spec.rb
capybara-3.3.1 lib/capybara/spec/session/current_scope_spec.rb
capybara-3.3.0 lib/capybara/spec/session/current_scope_spec.rb
capybara-3.2.1 lib/capybara/spec/session/current_scope_spec.rb
capybara-3.2.0 lib/capybara/spec/session/current_scope_spec.rb
capybara-3.1.1 lib/capybara/spec/session/current_scope_spec.rb
capybara-3.1.0 lib/capybara/spec/session/current_scope_spec.rb
capybara-3.0.3 lib/capybara/spec/session/current_scope_spec.rb
capybara-3.0.2 lib/capybara/spec/session/current_scope_spec.rb
capybara-3.0.1 lib/capybara/spec/session/current_scope_spec.rb
capybara-3.0.0 lib/capybara/spec/session/current_scope_spec.rb
capybara-3.0.0.rc2 lib/capybara/spec/session/current_scope_spec.rb
capybara-3.0.0.rc1 lib/capybara/spec/session/current_scope_spec.rb