Sha256: 0b9fa082eef6d5c4f76830a0091e9f124e83d6940a3e0376daa32f72331f0c55

Contents?: true

Size: 816 Bytes

Versions: 17

Compression:

Stored size: 816 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
      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

17 entries across 17 versions & 4 rubygems

Version Path
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/capybara-2.4.4/lib/capybara/spec/session/current_scope_spec.rb
capybara-2.6.2 lib/capybara/spec/session/current_scope_spec.rb
capybara-2.6.1 lib/capybara/spec/session/current_scope_spec.rb
capybara-2.6.0 lib/capybara/spec/session/current_scope_spec.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/capybara-2.4.4/lib/capybara/spec/session/current_scope_spec.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/capybara-2.4.4/lib/capybara/spec/session/current_scope_spec.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/capybara-2.4.4/lib/capybara/spec/session/current_scope_spec.rb
capybara-2.5.0 lib/capybara/spec/session/current_scope_spec.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/capybara-2.4.4/lib/capybara/spec/session/current_scope_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/capybara-2.4.4/lib/capybara/spec/session/current_scope_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/capybara-2.4.4/lib/capybara/spec/session/current_scope_spec.rb
capybara-2.4.4 lib/capybara/spec/session/current_scope_spec.rb
capybara-2.4.3 lib/capybara/spec/session/current_scope_spec.rb
capybara-2.4.2 lib/capybara/spec/session/current_scope_spec.rb
capybara-2.4.1 lib/capybara/spec/session/current_scope_spec.rb
capybara-2.4.0 lib/capybara/spec/session/current_scope_spec.rb
capybara-2.3.0 lib/capybara/spec/session/current_scope_spec.rb