watirsplash 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ === Version 1.4.3 / 2011-06-05
2
+
3
+ * fix #change matcher in conjunction with #within for rspec 2.6.0
4
+
1
5
  === Version 1.4.2 / 2011-06-01
2
6
 
3
7
  * handle correctly RSpec shared examples by html formatter
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.2
1
+ 1.4.3
@@ -78,13 +78,15 @@ module RSpec::Matchers
78
78
  class Change
79
79
  def matches?(event_proc)
80
80
  raise_block_syntax_error if block_given?
81
-
81
+
82
82
  # to make #change work with #in(timeout) method
83
- @before = evaluate_value_proc unless defined? @before
84
- event_proc.call
85
- @after = evaluate_value_proc
86
-
87
- (!change_expected? || changed?) && matches_before? && matches_after? && matches_amount? && matches_min? && matches_max?
83
+ unless defined? @actual_before
84
+ @actual_before = evaluate_value_proc
85
+ event_proc.call
86
+ end
87
+ @actual_after = evaluate_value_proc
88
+
89
+ (!change_expected? || changed?) && matches_before? && matches_after? && matches_expected_delta? && matches_min? && matches_max?
88
90
  end
89
91
  end
90
92
 
@@ -7,36 +7,46 @@ describe "RSpec patches" do
7
7
  context "RSpec::Matchers" do
8
8
  context "#within" do
9
9
  it "can be used with #change" do
10
+ t = Time.now
10
11
  expect {
11
12
  link(:id => "toggle").click
12
13
  }.to change {div(:id => "div2").text}.from("Div is shown").to("Div is hidden").within(2)
14
+ (Time.now - t).should be <= 2
13
15
  end
14
16
 
15
17
  it "will fail upon timeout" do
18
+ t = Time.now
16
19
  expect {
17
20
  expect {
18
21
  link(:id => "toggle").click
19
- }.to change {div(:id => "div2").text}.from("Div is shown").to("Div is hidden").within(0.1)
22
+ }.to change {div(:id => "div2").text}.from("Div is shown").to("Div is hidden").within(0.5)
20
23
  }.to raise_exception(%q{result should have been changed to "Div is hidden", but is now "Div is shown"})
24
+ (Time.now - t).should be >= 0.5
21
25
  end
22
26
 
23
27
  it "can be used with #make" do
28
+ t = Time.now
24
29
  expect {
25
30
  link(:id => "toggle").click
26
31
  }.to make {div(:id => "div1").present?}.within(2)
32
+ (Time.now - t).should be <= 2
27
33
  end
28
34
 
29
35
  it "handles #should_not via matcher's #matches?" do
36
+ t = Time.now
30
37
  h = {:special => true}
31
38
  Thread.new {sleep 0.5; h.delete :special}
32
39
  h.should_not have_key(:special).within(1)
40
+ (Time.now - t).should be_between(0.5, 1)
33
41
  end
34
42
 
35
43
  it "fails when #should_not is not satisfied within timeout via matcher's #matches?" do
44
+ t = Time.now
36
45
  h = {:special => true}
37
46
  expect {
38
- h.should_not have_key(:special).within(0.1)
47
+ h.should_not have_key(:special).within(0.5)
39
48
  }.to raise_error
49
+ (Time.now - t).should be >= 0.5
40
50
  end
41
51
 
42
52
  it "handles #should_not via matcher's #does_not_match?" do
@@ -46,9 +56,11 @@ describe "RSpec patches" do
46
56
  end
47
57
  end
48
58
 
59
+ t = Time.now
49
60
  h = {:special => true}
50
61
  Thread.new {sleep 0.5; h.delete :special}
51
62
  h.should_not have_my_key(:special).within(1)
63
+ (Time.now - t).should be_between(0.5, 1)
52
64
  end
53
65
 
54
66
  it "fails when #should_not is not satisfied within timeout via matcher's #does_not_match?" do
@@ -58,18 +70,22 @@ describe "RSpec patches" do
58
70
  end
59
71
  end
60
72
 
73
+ t = Time.now
61
74
  h = {:special => true}
62
75
  expect {
63
- h.should_not have_my_key(:special).within(0.1)
76
+ h.should_not have_my_key(:special).within(0.5)
64
77
  }.to raise_error
78
+ (Time.now - t).should be >= 0.5
65
79
  end
66
80
  end
67
81
 
68
82
  context "#soon" do
69
83
  it "is an alias for #in(30)" do
84
+ t = Time.now
70
85
  expect {
71
86
  link(:id => "toggle").click
72
87
  }.to make {div(:id => "div1").present?}.soon
88
+ (Time.now - t).should be <= 30
73
89
  end
74
90
  end
75
91
 
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: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 2
10
- version: 1.4.2
9
+ - 3
10
+ version: 1.4.3
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-06-01 00:00:00 Z
18
+ date: 2011-06-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec
@@ -131,7 +131,7 @@ licenses: []
131
131
  post_install_message: |-
132
132
  *************************
133
133
 
134
- Thank you for installing WatirSplash 1.4.2! Don't forget to take a look at the README and History files!
134
+ Thank you for installing WatirSplash 1.4.3! Don't forget to take a look at the README and History files!
135
135
 
136
136
  Execute `watirsplash new` under your project's directory to generate a default project structure.
137
137
 
@@ -169,7 +169,7 @@ rubyforge_project:
169
169
  rubygems_version: 1.8.4
170
170
  signing_key:
171
171
  specification_version: 3
172
- summary: watirsplash 1.4.2
172
+ summary: watirsplash 1.4.3
173
173
  test_files:
174
174
  - spec/file_helper_spec.rb
175
175
  - spec/rspec_patches_spec.rb