watirsplash 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,3 +1,8 @@
1
+ === Version 1.3.0 / 2011-04-22
2
+
3
+ * handle RSpec's #should_not correctly when using #in(timeout)
4
+ * added #soon for RSpec's matcher as an alias for #in(30)
5
+
1
6
  === Version 1.2.1 / 2011-04-17
2
7
 
3
8
  * use RSpec's multiple formatters support functionality directly
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.3.0
@@ -103,6 +103,10 @@ end
103
103
  # div.click
104
104
  # }.to make {another_div.present?}.in(5)
105
105
  #
106
+ # expect {
107
+ # div.click
108
+ # }.to change {another_div.text}.soon
109
+ #
106
110
  # use with ActiveSupport to use descriptive methods for numbers:
107
111
  # require "active_support"
108
112
  # another_div.should exist.in(5.minutes)
@@ -113,6 +117,10 @@ RSpec::Matchers.constants.each do |const|
113
117
  self
114
118
  end
115
119
 
120
+ def soon
121
+ self.in(30)
122
+ end
123
+
116
124
  inst_methods = instance_methods.map {|m| m.to_sym}
117
125
 
118
126
  if inst_methods.include? :matches?
@@ -129,6 +137,10 @@ RSpec::Matchers.constants.each do |const|
129
137
  def does_not_match?(actual)
130
138
  @timeout ? (Watir::Wait.until(@timeout) {__does_not_match?(actual)} rescue false) : __does_not_match?(actual)
131
139
  end
140
+ else
141
+ def does_not_match?(actual)
142
+ @timeout ? !(Watir::Wait.while(@timeout) {__matches?(actual)} rescue true) : !__matches?(actual)
143
+ end
132
144
  end
133
145
  end
134
146
  end
@@ -26,7 +26,20 @@ describe "RSpec patches" do
26
26
  }.to make {div(:id => "div1").present?}.in(2)
27
27
  end
28
28
 
29
- it "handles also #does_not_match?" do
29
+ it "handles #should_not via matcher's #matches?" do
30
+ h = {:special => true}
31
+ Thread.new {sleep 0.5; h.delete :special}
32
+ h.should_not have_key(:special).in(1)
33
+ end
34
+
35
+ it "fails when #should_not is not satisfied within timeout via matcher's #matches?" do
36
+ h = {:special => true}
37
+ expect {
38
+ h.should_not have_key(:special).in(0.1)
39
+ }.to raise_error
40
+ end
41
+
42
+ it "handles #should_not via matcher's #does_not_match?" do
30
43
  RSpec::Matchers.define :have_my_key do |expected|
31
44
  match_for_should_not do |actual|
32
45
  !actual.has_key?(expected)
@@ -37,6 +50,27 @@ describe "RSpec patches" do
37
50
  Thread.new {sleep 0.5; h.delete :special}
38
51
  h.should_not have_my_key(:special).in(1)
39
52
  end
53
+
54
+ it "fails when #should_not is not satisfied within timeout via matcher's #does_not_match?" do
55
+ RSpec::Matchers.define :have_my_key do |expected|
56
+ match_for_should_not do |actual|
57
+ !actual.has_key?(expected)
58
+ end
59
+ end
60
+
61
+ h = {:special => true}
62
+ expect {
63
+ h.should_not have_my_key(:special).in(0.1)
64
+ }.to raise_error
65
+ end
66
+ end
67
+
68
+ context "#soon" do
69
+ it "is an alias for #in(30)" do
70
+ expect {
71
+ link(:id => "toggle").click
72
+ }.to make {div(:id => "div1").present?}.soon
73
+ end
40
74
  end
41
75
 
42
76
  context "#make" do
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: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 2
9
- - 1
10
- version: 1.2.1
8
+ - 3
9
+ - 0
10
+ version: 1.3.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-17 00:00:00 +03:00
18
+ date: 2011-04-22 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.2.1! Don't forget to take a look at the README and History files!
137
+ Thank you for installing WatirSplash 1.3.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.2.1
176
+ summary: watirsplash 1.3.0
177
177
  test_files:
178
178
  - spec/file_helper_spec.rb
179
179
  - spec/rspec_patches_spec.rb