wildcard_finders 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/VERSION +1 -1
- data/lib/wildcard_finders/matchers.rb +27 -1
- data/spec/wildcard_finders/matchers_spec.rb +16 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9a44948a9167397000feb8d66fc6934c901fa80
|
4
|
+
data.tar.gz: be4c180e8adad420445ceaac79d8ed702be9f025
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eb482e38b8eb89394f53676cf2dcc60bfc97264f692ee8280ffedc27eb3291cee31185f61182e818d9ef0c4183c6100d90ce5fcd65f2593d0a3dbf47da8f470
|
7
|
+
data.tar.gz: 1b063c025d5f3780502d4e64054904be2fcefad013f0890285111f56676b767064cd5f90c3d3c3bfe04d6bdb5f34bb5e7c799443035d75b05545f707b3f388c2
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "capybara/node/matchers"
|
2
|
-
|
2
|
+
require "tapp"
|
3
3
|
module WildcardFinders
|
4
4
|
module Matchers
|
5
5
|
METHODS = []
|
@@ -13,6 +13,11 @@ module WildcardFinders
|
|
13
13
|
matcher_method = method.to_s.sub("find", "has") + "?"
|
14
14
|
no_matcher_method = method.to_s.sub("find", "has_no") + "?"
|
15
15
|
|
16
|
+
rspec_matcher_method = method.to_s.sub("find", "have")
|
17
|
+
rspec_matcher_method_without_block = method.to_s.sub("find", "have") + "_without_block"
|
18
|
+
rspec_no_matcher_method = method.to_s.sub("find", "have_no")
|
19
|
+
rspec_no_matcher_method_without_block = method.to_s.sub("find", "have_no") + "_without_block"
|
20
|
+
|
16
21
|
define_method(matcher_method) do |*args, &block|
|
17
22
|
wait_method = respond_to?(:synchronize) ? :synchronize : :wait_until
|
18
23
|
|
@@ -34,6 +39,27 @@ module WildcardFinders
|
|
34
39
|
|
35
40
|
true
|
36
41
|
end
|
42
|
+
|
43
|
+
RSpec::Matchers.define(rspec_matcher_method_without_block) do |expected|
|
44
|
+
match do |page|
|
45
|
+
page.__send__(matcher_method, expected)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
RSpec::Matchers.define(rspec_no_matcher_method_without_block) do |expected|
|
50
|
+
match do |page|
|
51
|
+
page.__send__(no_matcher_method, expected)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Note: block_given? does not work in define_method
|
56
|
+
RSpec::Matchers.__send__(:define_method, rspec_matcher_method) do |expected = nil, &block|
|
57
|
+
__send__(rspec_matcher_method_without_block, (block ? block : expected))
|
58
|
+
end
|
59
|
+
|
60
|
+
RSpec::Matchers.__send__(:define_method, rspec_no_matcher_method) do |expected = nil, &block|
|
61
|
+
__send__(rspec_no_matcher_method_without_block, (block ? block : expected))
|
62
|
+
end
|
37
63
|
end
|
38
64
|
end
|
39
65
|
end
|
@@ -7,11 +7,19 @@ describe WildcardFinders::Matchers do
|
|
7
7
|
it "returns true when there is an anchor" do
|
8
8
|
visit "/a"
|
9
9
|
page.has_anchor_like?(href: /hoge/).should be_true
|
10
|
+
page.should have_anchor_like(href: /hoge/)
|
11
|
+
|
12
|
+
page.has_anchor_like? {|a| /hoge/ === a[:href] }.should be_true
|
13
|
+
page.should have_anchor_like {|a| /hoge/ === a[:href] }
|
10
14
|
end
|
11
15
|
|
12
16
|
it "returns true when ther are no anchors" do
|
13
17
|
visit "/a"
|
14
18
|
page.has_anchor_like?(href: /not_exist/).should be_false
|
19
|
+
page.should_not have_anchor_like(href: /not_exist/)
|
20
|
+
|
21
|
+
page.has_anchor_like? {|a| /not_exist/ === a[:href] }.should be_false
|
22
|
+
page.should_not have_anchor_like {|a| /not_exist/ === a[:href] }
|
15
23
|
end
|
16
24
|
end
|
17
25
|
|
@@ -19,11 +27,19 @@ describe WildcardFinders::Matchers do
|
|
19
27
|
it "returns true when there is an anchor" do
|
20
28
|
visit "/a"
|
21
29
|
page.has_no_anchor_like?(href: /hoge/).should be_false
|
30
|
+
page.should_not have_no_anchor_like(href: /hoge/)
|
31
|
+
|
32
|
+
page.has_no_anchor_like? {|a| /hoge/ === a[:href] }.should be_false
|
33
|
+
page.should_not have_no_anchor_like {|a| /hoge/ === a[:href] }
|
22
34
|
end
|
23
35
|
|
24
36
|
it "returns true when ther are no anchors" do
|
25
37
|
visit "/a"
|
26
38
|
page.has_no_anchor_like?(href: /not_exist/).should be_true
|
39
|
+
page.should have_no_anchor_like(href: /not_exist/)
|
40
|
+
|
41
|
+
page.has_no_anchor_like? {|a| /not_exist/ === a[:href] }.should be_true
|
42
|
+
page.should have_no_anchor_like {|a| /not_exist/ === a[:href] }
|
27
43
|
end
|
28
44
|
end
|
29
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wildcard_finders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- okitan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
184
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.0.
|
185
|
+
rubygems_version: 2.0.5
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: finders for people strugling non-semantic doms
|