watirsplash 1.3.0 → 1.4.0
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.
- data/History.rdoc +5 -0
- data/VERSION +1 -1
- data/lib/watirsplash/rspec_patches.rb +31 -8
- data/spec/rspec_patches_spec.rb +30 -10
- metadata +6 -6
data/History.rdoc
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
=== Version 1.4.0 / 2011-04-30
|
|
2
|
+
|
|
3
|
+
* deprecated #in(timeout) method - use #within(timeout) instead
|
|
4
|
+
* added #seconds/#second and #minutes/#minute method to RSpec matchers for making it possible to use them together with #within(timeout) method
|
|
5
|
+
|
|
1
6
|
=== Version 1.3.0 / 2011-04-22
|
|
2
7
|
|
|
3
8
|
* handle RSpec's #should_not correctly when using #in(timeout)
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.4.0
|
|
@@ -112,17 +112,40 @@ end
|
|
|
112
112
|
# another_div.should exist.in(5.minutes)
|
|
113
113
|
RSpec::Matchers.constants.each do |const|
|
|
114
114
|
RSpec::Matchers.const_get(const).class_eval do
|
|
115
|
-
def in(timeout)
|
|
116
|
-
@timeout = timeout
|
|
117
|
-
self
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
def soon
|
|
121
|
-
self.in(30)
|
|
122
|
-
end
|
|
123
115
|
|
|
124
116
|
inst_methods = instance_methods.map {|m| m.to_sym}
|
|
125
117
|
|
|
118
|
+
if inst_methods.include?(:matches?) || inst_methods.include?(:does_not_match?)
|
|
119
|
+
def in(timeout)
|
|
120
|
+
Kernel.warn "DEPRECATION NOTICE: #in(timeout) is DEPRECATED, please use #within(timeout) method instead!"
|
|
121
|
+
within(timeout)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def within(timeout)
|
|
125
|
+
@timeout = timeout
|
|
126
|
+
self
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def soon
|
|
130
|
+
within(30)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def seconds
|
|
134
|
+
# for syntactic sugar
|
|
135
|
+
self
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
alias_method :second, :seconds
|
|
139
|
+
|
|
140
|
+
def minutes
|
|
141
|
+
return unless @timeout
|
|
142
|
+
@timeout *= 60
|
|
143
|
+
self
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
alias_method :minute, :minutes
|
|
147
|
+
end
|
|
148
|
+
|
|
126
149
|
if inst_methods.include? :matches?
|
|
127
150
|
alias_method :__matches?, :matches?
|
|
128
151
|
|
data/spec/rspec_patches_spec.rb
CHANGED
|
@@ -5,37 +5,37 @@ describe "RSpec patches" do
|
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
context "RSpec::Matchers" do
|
|
8
|
-
context "#
|
|
8
|
+
context "#within" do
|
|
9
9
|
it "can be used with #change" do
|
|
10
10
|
expect {
|
|
11
11
|
link(:id => "toggle").click
|
|
12
|
-
}.to change {div(:id => "div2").text}.from("Div is shown").to("Div is hidden").
|
|
12
|
+
}.to change {div(:id => "div2").text}.from("Div is shown").to("Div is hidden").within(2)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
it "will fail upon timeout" do
|
|
16
16
|
expect {
|
|
17
17
|
expect {
|
|
18
18
|
link(:id => "toggle").click
|
|
19
|
-
}.to change {div(:id => "div2").text}.from("Div is shown").to("Div is hidden").
|
|
19
|
+
}.to change {div(:id => "div2").text}.from("Div is shown").to("Div is hidden").within(0.1)
|
|
20
20
|
}.to raise_exception(%q{result should have been changed to "Div is hidden", but is now "Div is shown"})
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it "can be used with #make" do
|
|
24
24
|
expect {
|
|
25
25
|
link(:id => "toggle").click
|
|
26
|
-
}.to make {div(:id => "div1").present?}.
|
|
26
|
+
}.to make {div(:id => "div1").present?}.within(2)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
it "handles #should_not via matcher's #matches?" do
|
|
30
30
|
h = {:special => true}
|
|
31
31
|
Thread.new {sleep 0.5; h.delete :special}
|
|
32
|
-
h.should_not have_key(:special).
|
|
32
|
+
h.should_not have_key(:special).within(1)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
it "fails when #should_not is not satisfied within timeout via matcher's #matches?" do
|
|
36
36
|
h = {:special => true}
|
|
37
37
|
expect {
|
|
38
|
-
h.should_not have_key(:special).
|
|
38
|
+
h.should_not have_key(:special).within(0.1)
|
|
39
39
|
}.to raise_error
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -48,9 +48,9 @@ describe "RSpec patches" do
|
|
|
48
48
|
|
|
49
49
|
h = {:special => true}
|
|
50
50
|
Thread.new {sleep 0.5; h.delete :special}
|
|
51
|
-
h.should_not have_my_key(:special).
|
|
51
|
+
h.should_not have_my_key(:special).within(1)
|
|
52
52
|
end
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
it "fails when #should_not is not satisfied within timeout via matcher's #does_not_match?" do
|
|
55
55
|
RSpec::Matchers.define :have_my_key do |expected|
|
|
56
56
|
match_for_should_not do |actual|
|
|
@@ -60,7 +60,7 @@ describe "RSpec patches" do
|
|
|
60
60
|
|
|
61
61
|
h = {:special => true}
|
|
62
62
|
expect {
|
|
63
|
-
h.should_not have_my_key(:special).
|
|
63
|
+
h.should_not have_my_key(:special).within(0.1)
|
|
64
64
|
}.to raise_error
|
|
65
65
|
end
|
|
66
66
|
end
|
|
@@ -80,6 +80,26 @@ describe "RSpec patches" do
|
|
|
80
80
|
}.to make {text_field(:name => "field1").value.empty?}
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
|
-
end
|
|
84
83
|
|
|
84
|
+
context "#seconds" do
|
|
85
|
+
it "is for syntactic sugar" do
|
|
86
|
+
RSpec::Matchers::Matcher.new(nil) {}.within(2).seconds.instance_variable_get(:@timeout).should == 2
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it "has #second as an alias" do
|
|
90
|
+
RSpec::Matchers::Matcher.new(nil) {}.within(1).second.instance_variable_get(:@timeout).should == 1
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
context "#minutes" do
|
|
95
|
+
it "converts timeout into minutes" do
|
|
96
|
+
RSpec::Matchers::Matcher.new(nil) {}.within(2).minutes.instance_variable_get(:@timeout).should == 2*60
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
it "has #minute as an alias" do
|
|
100
|
+
RSpec::Matchers::Matcher.new(nil) {}.within(1).minute.instance_variable_get(:@timeout).should == 1*60
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
end
|
|
85
105
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: watirsplash
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 7
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 1
|
|
8
|
-
-
|
|
8
|
+
- 4
|
|
9
9
|
- 0
|
|
10
|
-
version: 1.
|
|
10
|
+
version: 1.4.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Jarmo Pertman
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-04-
|
|
18
|
+
date: 2011-04-30 00:00:00 +03:00
|
|
19
19
|
default_executable: watirsplash
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -134,7 +134,7 @@ licenses: []
|
|
|
134
134
|
post_install_message: |-
|
|
135
135
|
*************************
|
|
136
136
|
|
|
137
|
-
Thank you for installing WatirSplash 1.
|
|
137
|
+
Thank you for installing WatirSplash 1.4.0! Don't forget to take a look at the README and History files!
|
|
138
138
|
|
|
139
139
|
Execute `watirsplash new` under your project's directory to generate a default project structure.
|
|
140
140
|
|
|
@@ -173,7 +173,7 @@ rubyforge_project:
|
|
|
173
173
|
rubygems_version: 1.3.7
|
|
174
174
|
signing_key:
|
|
175
175
|
specification_version: 3
|
|
176
|
-
summary: watirsplash 1.
|
|
176
|
+
summary: watirsplash 1.4.0
|
|
177
177
|
test_files:
|
|
178
178
|
- spec/file_helper_spec.rb
|
|
179
179
|
- spec/rspec_patches_spec.rb
|