Sha256: cfe7af68dc04731a1fc34bb0c0493363f73b3271683f21d844567ddaa7731d4d

Contents?: true

Size: 1.27 KB

Versions: 17

Compression:

Stored size: 1.27 KB

Contents

Capybara::SpecHelper.spec "#uncheck" do
  before do
    @session.visit('/form')
  end

  it "should uncheck a checkbox by id" do
    @session.uncheck("form_pets_hamster")
    @session.click_button('awesome')
    expect(extract_results(@session)['pets']).to include('dog')
    expect(extract_results(@session)['pets']).not_to include('hamster')
  end

  it "should uncheck a checkbox by label" do
    @session.uncheck("Hamster")
    @session.click_button('awesome')
    expect(extract_results(@session)['pets']).to include('dog')
    expect(extract_results(@session)['pets']).not_to include('hamster')
  end

  it "casts to string" do
    @session.uncheck(:"form_pets_hamster")
    @session.click_button('awesome')
    expect(extract_results(@session)['pets']).to include('dog')
    expect(extract_results(@session)['pets']).not_to include('hamster')
  end

  context "with :exact option" do
    it "should accept partial matches when false" do
      @session.uncheck('Ham', :exact => false)
      @session.click_button('awesome')
      expect(extract_results(@session)['pets']).not_to include('hamster')
    end

    it "should not accept partial matches when true" do
      expect do
        @session.uncheck('Ham', :exact => true)
      end.to raise_error(Capybara::ElementNotFound)
    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/uncheck_spec.rb
capybara-2.6.2 lib/capybara/spec/session/uncheck_spec.rb
capybara-2.6.1 lib/capybara/spec/session/uncheck_spec.rb
capybara-2.6.0 lib/capybara/spec/session/uncheck_spec.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/capybara-2.4.4/lib/capybara/spec/session/uncheck_spec.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/capybara-2.4.4/lib/capybara/spec/session/uncheck_spec.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/capybara-2.4.4/lib/capybara/spec/session/uncheck_spec.rb
capybara-2.5.0 lib/capybara/spec/session/uncheck_spec.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/capybara-2.4.4/lib/capybara/spec/session/uncheck_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/capybara-2.4.4/lib/capybara/spec/session/uncheck_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/capybara-2.4.4/lib/capybara/spec/session/uncheck_spec.rb
capybara-2.4.4 lib/capybara/spec/session/uncheck_spec.rb
capybara-2.4.3 lib/capybara/spec/session/uncheck_spec.rb
capybara-2.4.2 lib/capybara/spec/session/uncheck_spec.rb
capybara-2.4.1 lib/capybara/spec/session/uncheck_spec.rb
capybara-2.4.0 lib/capybara/spec/session/uncheck_spec.rb
capybara-2.3.0 lib/capybara/spec/session/uncheck_spec.rb