Sha256: 1b84480f434cc604f1ec03f7631cac68927fdcc6d7c73664a8a77218e3c403f1

Contents?: true

Size: 1.49 KB

Versions: 3

Compression:

Stored size: 1.49 KB

Contents

require "spec_helper"

describe WildcardFinders::Matchers do
  include WildcardFinders::Matchers

  context ".has_anchor_like?" do
    it "returns true when there is an anchor" do
      visit "/a"
      page.has_anchor_like?(href: /hoge/).should be_true
      page.should have_anchor_like(href: /hoge/)

      page.has_anchor_like? {|a| /hoge/ === a[:href] }.should be_true
      page.should have_anchor_like {|a| /hoge/ === a[:href] }
    end

    it "returns true when ther are no anchors" do
      visit "/a"
      page.has_anchor_like?(href: /not_exist/).should be_false
      page.should_not have_anchor_like(href: /not_exist/)

      page.has_anchor_like? {|a| /not_exist/ === a[:href] }.should be_false
      page.should_not have_anchor_like {|a| /not_exist/ === a[:href] }
    end
  end

  context ".has_no_anchor_like?" do
    it "returns true when there is an anchor" do
      visit "/a"
      page.has_no_anchor_like?(href: /hoge/).should be_false
      page.should_not have_no_anchor_like(href: /hoge/)

      page.has_no_anchor_like? {|a| /hoge/ === a[:href] }.should be_false
      page.should_not have_no_anchor_like {|a| /hoge/ === a[:href] }
    end

    it "returns true when ther are no anchors" do
      visit "/a"
      page.has_no_anchor_like?(href: /not_exist/).should be_true
      page.should have_no_anchor_like(href: /not_exist/)

      page.has_no_anchor_like? {|a| /not_exist/ === a[:href] }.should be_true
      page.should have_no_anchor_like {|a| /not_exist/ === a[:href] }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wildcard_finders-0.2.1 spec/wildcard_finders/matchers_spec.rb
wildcard_finders-0.2.0 spec/wildcard_finders/matchers_spec.rb
wildcard_finders-0.1.1 spec/wildcard_finders/matchers_spec.rb