Sha256: 25f8d139a161bffcec8b2f3669586f718a20553452be79f6293743f69d88f964

Contents?: true

Size: 1.4 KB

Versions: 15

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

RSpec.describe 'Capybara RSpec Matchers', :type => :feature do
  context "after called on session" do
    it "HaveSelector should allow getting a description of the matcher" do
      visit('/with_html')
      matcher = have_selector(:css, 'h2.head', minimum: 3)
      expect(page).to matcher
      expect { matcher.description }.not_to raise_error
    end

    it "HaveText should allow getting a description" do
      visit('/with_html')
      matcher = have_text("Lorem")
      expect(page).to matcher
      expect { matcher.description }.not_to raise_error
    end
  end

  context "after called on element" do
    it "HaveSelector should allow getting a description" do
      visit('/with_html')
      el = find(:css, '#first')
      matcher = have_selector(:css, 'a#foo')
      expect(el).to matcher
      expect { matcher.description }.not_to raise_error
    end

    it "MatchSelector should allow getting a description" do
      visit('/with_html')
      el = find(:css, '#first')
      matcher = match_selector(:css, '#first')
      expect(el).to matcher
      expect { matcher.description }.not_to raise_error
    end

    it "HaveText should allow getting a description" do
      visit('/with_html')
      el = find(:css, '#first')
      matcher = have_text("Lorem")
      expect(el).to matcher
      expect { matcher.description }.not_to raise_error
    end
  end
end

Version data entries

15 entries across 13 versions & 2 rubygems

Version Path
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/capybara-2.18.0/spec/rspec_matchers_spec.rb
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/vendor/bundle/gems/capybara-2.16.1/spec/rspec_matchers_spec.rb
tdiary-5.0.8 vendor/bundle/gems/capybara-2.18.0/spec/rspec_matchers_spec.rb
capybara-2.18.0 spec/rspec_matchers_spec.rb
capybara-2.17.0 spec/rspec_matchers_spec.rb
tdiary-5.0.7 vendor/bundle/gems/capybara-2.16.1/spec/rspec_matchers_spec.rb
capybara-2.16.1 spec/rspec_matchers_spec.rb
capybara-2.16.0 spec/rspec_matchers_spec.rb
capybara-2.15.4 spec/rspec_matchers_spec.rb
capybara-2.15.3 spec/rspec_matchers_spec.rb
capybara-2.15.2 spec/rspec_matchers_spec.rb
tdiary-5.0.6 vendor/bundle/gems/capybara-2.15.1/spec/rspec_matchers_spec.rb
capybara-2.15.1 spec/rspec_matchers_spec.rb
capybara-2.15.0 spec/rspec_matchers_spec.rb
capybara-2.14.4 spec/rspec_matchers_spec.rb