Sha256: 872bbeb35e6c1442a1ac415f28b83cd648a9fee05e9d56495c7b44d2c5080572

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

require "spec_helper"

describe WildcardFinders::Finders do
  include WildcardFinders::Finders

  context ".find_anchor_like" do
    where(:attr, :value, :expected_id) do
      [ [ :href,    /hoge/, "href_hoge" ],
        [ :href,    /fuga/, "href_fuga" ],
        [ :onclick, /hoge/, "onclick_hoge" ],
      ]
    end

    with_them do
      it "with hash as matcher ({ attr => value }) finds" do
        visit "/a"
        page.find_anchor_like(attr => value)[:id].should == expected_id
      end

      it "with block as matcher ({|e| value === e[attr] }) finds" do
        visit "/a"
        page.find_anchor_like {|e| value === e[attr] }[:id].should == expected_id
      end

      it "with proc as matcher (->(e) { value === e[attr] }) finds" do
        visit "/a"
        page.find_anchor_like(->(e) { value === e[attr] })[:id].should == expected_id
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wildcard_finders-0.0.2 spec/wildcard_finders/finders_spec.rb