capybara 2.0.0.beta2 → 2.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/History.txt +30 -1
  2. data/README.md +52 -31
  3. data/lib/capybara.rb +1 -0
  4. data/lib/capybara/driver/base.rb +1 -1
  5. data/lib/capybara/driver/node.rb +1 -0
  6. data/lib/capybara/dsl.rb +12 -5
  7. data/lib/capybara/helpers.rb +33 -0
  8. data/lib/capybara/node/actions.rb +4 -2
  9. data/lib/capybara/node/base.rb +52 -1
  10. data/lib/capybara/node/element.rb +0 -12
  11. data/lib/capybara/node/finders.rb +1 -1
  12. data/lib/capybara/node/matchers.rb +57 -47
  13. data/lib/capybara/node/simple.rb +4 -0
  14. data/lib/capybara/query.rb +11 -11
  15. data/lib/capybara/rack_test/browser.rb +14 -15
  16. data/lib/capybara/rack_test/driver.rb +2 -2
  17. data/lib/capybara/rack_test/node.rb +15 -2
  18. data/lib/capybara/result.rb +7 -19
  19. data/lib/capybara/rspec.rb +7 -4
  20. data/lib/capybara/rspec/features.rb +4 -1
  21. data/lib/capybara/rspec/matchers.rb +8 -3
  22. data/lib/capybara/selector.rb +1 -2
  23. data/lib/capybara/selenium/driver.rb +2 -2
  24. data/lib/capybara/selenium/node.rb +9 -7
  25. data/lib/capybara/session.rb +47 -31
  26. data/lib/capybara/spec/fixtures/another_test_file.txt +1 -0
  27. data/lib/capybara/spec/public/test.js +1 -1
  28. data/lib/capybara/spec/session/all_spec.rb +60 -62
  29. data/lib/capybara/spec/session/assert_selector.rb +123 -0
  30. data/lib/capybara/spec/session/attach_file_spec.rb +72 -58
  31. data/lib/capybara/spec/session/body_spec.rb +21 -0
  32. data/lib/capybara/spec/session/check_spec.rb +67 -50
  33. data/lib/capybara/spec/session/choose_spec.rb +32 -21
  34. data/lib/capybara/spec/session/click_button_spec.rb +261 -221
  35. data/lib/capybara/spec/session/click_link_or_button_spec.rb +40 -30
  36. data/lib/capybara/spec/session/click_link_spec.rb +95 -81
  37. data/lib/capybara/spec/session/current_url_spec.rb +70 -60
  38. data/lib/capybara/spec/session/evaluate_script_spec.rb +6 -0
  39. data/lib/capybara/spec/session/execute_script_spec.rb +7 -0
  40. data/lib/capybara/spec/session/fill_in_spec.rb +118 -92
  41. data/lib/capybara/spec/session/find_button_spec.rb +16 -14
  42. data/lib/capybara/spec/session/find_by_id_spec.rb +16 -14
  43. data/lib/capybara/spec/session/find_field_spec.rb +23 -21
  44. data/lib/capybara/spec/session/find_link_spec.rb +15 -14
  45. data/lib/capybara/spec/session/find_spec.rb +96 -91
  46. data/lib/capybara/spec/session/first_spec.rb +53 -55
  47. data/lib/capybara/spec/session/has_button_spec.rb +22 -24
  48. data/lib/capybara/spec/session/has_css_spec.rb +190 -205
  49. data/lib/capybara/spec/session/has_field_spec.rb +167 -169
  50. data/lib/capybara/spec/session/has_link_spec.rb +26 -29
  51. data/lib/capybara/spec/session/has_select_spec.rb +175 -176
  52. data/lib/capybara/spec/session/has_selector_spec.rb +94 -100
  53. data/lib/capybara/spec/session/has_table_spec.rb +22 -26
  54. data/lib/capybara/spec/session/has_text_spec.rb +159 -132
  55. data/lib/capybara/spec/session/has_xpath_spec.rb +100 -96
  56. data/lib/capybara/spec/session/headers.rb +4 -17
  57. data/lib/capybara/spec/session/html_spec.rb +15 -0
  58. data/lib/capybara/spec/session/node_spec.rb +172 -82
  59. data/lib/capybara/spec/session/reset_session_spec.rb +42 -0
  60. data/lib/capybara/spec/session/response_code.rb +4 -17
  61. data/lib/capybara/spec/session/save_page_spec.rb +46 -0
  62. data/lib/capybara/spec/session/screenshot.rb +8 -24
  63. data/lib/capybara/spec/session/select_spec.rb +100 -89
  64. data/lib/capybara/spec/session/source_spec.rb +12 -0
  65. data/lib/capybara/spec/session/text_spec.rb +15 -17
  66. data/lib/capybara/spec/session/uncheck_spec.rb +22 -17
  67. data/lib/capybara/spec/session/unselect_spec.rb +57 -52
  68. data/lib/capybara/spec/session/visit_spec.rb +58 -60
  69. data/lib/capybara/spec/session/within_frame_spec.rb +24 -26
  70. data/lib/capybara/spec/session/within_spec.rb +119 -121
  71. data/lib/capybara/spec/session/within_window_spec.rb +29 -31
  72. data/lib/capybara/spec/spec_helper.rb +84 -0
  73. data/lib/capybara/spec/test_app.rb +5 -3
  74. data/lib/capybara/spec/views/form.erb +1 -0
  75. data/lib/capybara/spec/views/with_html.erb +6 -1
  76. data/lib/capybara/spec/views/with_js.erb +1 -0
  77. data/lib/capybara/version.rb +1 -1
  78. data/spec/basic_node_spec.rb +2 -2
  79. data/spec/capybara_spec.rb +9 -0
  80. data/spec/dsl_spec.rb +22 -10
  81. data/spec/rack_test_spec.rb +28 -23
  82. data/spec/result_spec.rb +51 -0
  83. data/spec/rspec/features_spec.rb +19 -0
  84. data/spec/rspec/matchers_spec.rb +6 -0
  85. data/spec/rspec_spec.rb +1 -1
  86. data/spec/selenium_spec.rb +11 -25
  87. data/spec/server_spec.rb +2 -2
  88. data/spec/spec_helper.rb +1 -46
  89. metadata +41 -98
  90. data/lib/capybara/spec/session.rb +0 -183
  91. data/lib/capybara/spec/session/javascript.rb +0 -290
  92. data/lib/capybara/util/save_and_open_page.rb +0 -45
  93. data/spec/save_and_open_page_spec.rb +0 -155
@@ -1,32 +1,30 @@
1
- shared_examples_for "has_button" do
2
- describe '#has_button?' do
3
- before do
4
- @session.visit('/form')
5
- end
1
+ Capybara::SpecHelper.spec '#has_button?' do
2
+ before do
3
+ @session.visit('/form')
4
+ end
6
5
 
7
- it "should be true if the given button is on the page" do
8
- @session.should have_button('med')
9
- @session.should have_button('crap321')
10
- end
6
+ it "should be true if the given button is on the page" do
7
+ @session.should have_button('med')
8
+ @session.should have_button('crap321')
9
+ @session.should have_button(:'crap321')
10
+ end
11
11
 
12
- it "should be false if the given button is not on the page" do
13
- @session.should_not have_button('monkey')
14
- end
12
+ it "should be false if the given button is not on the page" do
13
+ @session.should_not have_button('monkey')
15
14
  end
15
+ end
16
16
 
17
- describe '#has_no_button?' do
18
- before do
19
- @session.visit('/form')
20
- end
17
+ Capybara::SpecHelper.spec '#has_no_button?' do
18
+ before do
19
+ @session.visit('/form')
20
+ end
21
21
 
22
- it "should be true if the given button is on the page" do
23
- @session.should_not have_no_button('med')
24
- @session.should_not have_no_button('crap321')
25
- end
22
+ it "should be true if the given button is on the page" do
23
+ @session.should_not have_no_button('med')
24
+ @session.should_not have_no_button('crap321')
25
+ end
26
26
 
27
- it "should be false if the given button is not on the page" do
28
- @session.should have_no_button('monkey')
29
- end
27
+ it "should be false if the given button is not on the page" do
28
+ @session.should have_no_button('monkey')
30
29
  end
31
30
  end
32
-
@@ -1,243 +1,228 @@
1
- shared_examples_for "has_css" do
2
- describe '#has_css?' do
3
- before do
4
- @session.visit('/with_html')
5
- end
6
-
7
- it "should be true if the given selector is on the page" do
8
- @session.should have_css("p")
9
- @session.should have_css("p a#foo")
1
+ Capybara::SpecHelper.spec '#has_css?' do
2
+ before do
3
+ @session.visit('/with_html')
4
+ end
5
+
6
+ it "should be true if the given selector is on the page" do
7
+ @session.should have_css("p")
8
+ @session.should have_css("p a#foo")
9
+ end
10
+
11
+ it "should be false if the given selector is not on the page" do
12
+ @session.should_not have_css("abbr")
13
+ @session.should_not have_css("p a#doesnotexist")
14
+ @session.should_not have_css("p.nosuchclass")
15
+ end
16
+
17
+ it "should respect scopes" do
18
+ @session.within "//p[@id='first']" do
19
+ @session.should have_css("a#foo")
20
+ @session.should_not have_css("a#red")
10
21
  end
22
+ end
23
+
24
+ it "should wait for content to appear", :requires => [:js] do
25
+ @session.visit('/with_js')
26
+ @session.click_link('Click me')
27
+ @session.should have_css("input[type='submit'][value='New Here']")
28
+ end
11
29
 
12
- it "should be false if the given selector is not on the page" do
13
- @session.should_not have_css("abbr")
14
- @session.should_not have_css("p a#doesnotexist")
15
- @session.should_not have_css("p.nosuchclass")
16
- end
17
-
18
- it "should respect scopes" do
19
- @session.within "//p[@id='first']" do
20
- @session.should have_css("a#foo")
21
- @session.should_not have_css("a#red")
22
- end
30
+ context "with between" do
31
+ it "should be true if the content occurs within the range given" do
32
+ @session.should have_css("p", :between => 1..4)
33
+ @session.should have_css("p a#foo", :between => 1..3)
34
+ @session.should have_css("p a.doesnotexist", :between => 0..8)
23
35
  end
24
36
 
25
- context "with between" do
26
- it "should be true if the content occurs within the range given" do
27
- @session.should have_css("p", :between => 1..4)
28
- @session.should have_css("p a#foo", :between => 1..3)
29
- end
37
+ it "should be false if the content occurs more or fewer times than range" do
38
+ @session.should_not have_css("p", :between => 6..11 )
39
+ @session.should_not have_css("p a#foo", :between => 4..7)
40
+ @session.should_not have_css("p a.doesnotexist", :between => 3..8)
41
+ end
42
+ end
30
43
 
31
- it "should be false if the content occurs more or fewer times than range" do
32
- @session.should_not have_css("p", :between => 6..11 )
33
- @session.should_not have_css("p a#foo", :between => 4..7)
34
- end
44
+ context "with count" do
45
+ it "should be true if the content occurs the given number of times" do
46
+ @session.should have_css("p", :count => 3)
47
+ @session.should have_css("p a#foo", :count => 1)
48
+ @session.should have_css("p a.doesnotexist", :count => 0)
49
+ end
35
50
 
36
- it "should be false if the content isn't on the page at all" do
37
- @session.should_not have_css("abbr", :between => 1..8)
38
- @session.should_not have_css("p a.doesnotexist", :between => 3..8)
39
- end
51
+ it "should be false if the content occurs a different number of times than the given" do
52
+ @session.should_not have_css("p", :count => 6)
53
+ @session.should_not have_css("p a#foo", :count => 2)
54
+ @session.should_not have_css("p a.doesnotexist", :count => 1)
40
55
  end
41
56
 
42
- context "with count" do
43
- it "should be true if the content is on the page the given number of times" do
44
- @session.should have_css("p", :count => 3)
45
- @session.should have_css("p a#foo", :count => 1)
46
- end
57
+ it "should coerce count to an integer" do
58
+ @session.should have_css("p", :count => "3")
59
+ @session.should have_css("p a#foo", :count => "1")
60
+ end
61
+ end
47
62
 
48
- it "should be false if the content occurs the given number of times" do
49
- @session.should_not have_css("p", :count => 6)
50
- @session.should_not have_css("p a#foo", :count => 2)
51
- end
63
+ context "with maximum" do
64
+ it "should be true when content occurs same or fewer times than given" do
65
+ @session.should have_css("h2.head", :maximum => 5) # edge case
66
+ @session.should have_css("h2", :maximum => 10)
67
+ @session.should have_css("p a.doesnotexist", :maximum => 1)
68
+ @session.should have_css("p a.doesnotexist", :maximum => 0)
69
+ end
52
70
 
53
- it "should be false if the content isn't on the page at all" do
54
- @session.should_not have_css("abbr", :count => 2)
55
- @session.should_not have_css("p a.doesnotexist", :count => 1)
56
- end
71
+ it "should be false when content occurs more times than given" do
72
+ @session.should_not have_css("h2.head", :maximum => 4) # edge case
73
+ @session.should_not have_css("h2", :maximum => 6)
74
+ @session.should_not have_css("p", :maximum => 1)
75
+ end
57
76
 
58
- it "should coerce count to an integer" do
59
- @session.should have_css("p", :count => "3")
60
- @session.should have_css("p a#foo", :count => "1")
61
- end
77
+ it "should coerce maximum to an integer" do
78
+ @session.should have_css("h2.head", :maximum => "5") # edge case
79
+ @session.should have_css("h2", :maximum => "10")
62
80
  end
81
+ end
63
82
 
64
- context "with maximum" do
65
- it "should be true when content occurs same or fewer times than given" do
66
- @session.should have_css("h2.head", :maximum => 5) # edge case
67
- @session.should have_css("h2", :maximum => 10)
68
- end
83
+ context "with minimum" do
84
+ it "should be true when content occurs same or more times than given" do
85
+ @session.should have_css("h2.head", :minimum => 5) # edge case
86
+ @session.should have_css("h2", :minimum => 3)
87
+ @session.should have_css("p a.doesnotexist", :minimum => 0)
88
+ end
69
89
 
70
- it "should be false when content occurs more times than given" do
71
- @session.should_not have_css("h2.head", :maximum => 4) # edge case
72
- @session.should_not have_css("h2", :maximum => 6)
73
- @session.should_not have_css("p", :maximum => 1)
74
- end
90
+ it "should be false when content occurs fewer times than given" do
91
+ @session.should_not have_css("h2.head", :minimum => 6) # edge case
92
+ @session.should_not have_css("h2", :minimum => 8)
93
+ @session.should_not have_css("p", :minimum => 10)
94
+ @session.should_not have_css("p a.doesnotexist", :minimum => 1)
95
+ end
75
96
 
76
- it "should be false if the content isn't on the page at all" do
77
- @session.should_not have_css("abbr", :maximum => 2)
78
- @session.should_not have_css("p a.doesnotexist", :maximum => 1)
79
- end
97
+ it "should coerce minimum to an integer" do
98
+ @session.should have_css("h2.head", :minimum => "5") # edge case
99
+ @session.should have_css("h2", :minimum => "3")
100
+ end
101
+ end
80
102
 
81
- it "should coerce maximum to an integer" do
82
- @session.should have_css("h2.head", :maximum => "5") # edge case
83
- @session.should have_css("h2", :maximum => "10")
84
- end
103
+ context "with text" do
104
+ it "should discard all matches where the given string is not contained" do
105
+ @session.should have_css("p a", :text => "Redirect", :count => 1)
106
+ @session.should_not have_css("p a", :text => "Doesnotexist")
85
107
  end
86
108
 
87
- context "with minimum" do
88
- it "should be true when content occurs same or more times than given" do
89
- @session.should have_css("h2.head", :minimum => 5) # edge case
90
- @session.should have_css("h2", :minimum => 3)
91
- end
109
+ it "should discard all matches where the given regexp is not matched" do
110
+ @session.should have_css("p a", :text => /re[dab]i/i, :count => 1)
111
+ @session.should_not have_css("p a", :text => /Red$/)
112
+ end
113
+ end
114
+ end
92
115
 
93
- it "should be false when content occurs fewer times than given" do
94
- @session.should_not have_css("h2.head", :minimum => 6) # edge case
95
- @session.should_not have_css("h2", :minimum => 8)
96
- @session.should_not have_css("p", :minimum => 10)
97
- end
116
+ Capybara::SpecHelper.spec '#has_no_css?' do
117
+ before do
118
+ @session.visit('/with_html')
119
+ end
120
+
121
+ it "should be false if the given selector is on the page" do
122
+ @session.should_not have_no_css("p")
123
+ @session.should_not have_no_css("p a#foo")
124
+ end
98
125
 
99
- it "should be false if the content isn't on the page at all" do
100
- @session.should_not have_css("abbr", :minimum => 2)
101
- @session.should_not have_css("p a.doesnotexist", :minimum => 7)
102
- end
126
+ it "should be true if the given selector is not on the page" do
127
+ @session.should have_no_css("abbr")
128
+ @session.should have_no_css("p a#doesnotexist")
129
+ @session.should have_no_css("p.nosuchclass")
130
+ end
103
131
 
104
- it "should coerce minimum to an integer" do
105
- @session.should have_css("h2.head", :minimum => "5") # edge case
106
- @session.should have_css("h2", :minimum => "3")
107
- end
132
+ it "should respect scopes" do
133
+ @session.within "//p[@id='first']" do
134
+ @session.should_not have_no_css("a#foo")
135
+ @session.should have_no_css("a#red")
108
136
  end
137
+ end
109
138
 
110
- context "with text" do
111
- it "should discard all matches where the given string is not contained" do
112
- @session.should have_css("p a", :text => "Redirect", :count => 1)
113
- @session.should_not have_css("p a", :text => "Doesnotexist")
114
- end
139
+ it "should wait for content to disappear", :requires => [:js] do
140
+ @session.visit('/with_js')
141
+ @session.click_link('Click me')
142
+ @session.should have_no_css("p#change")
143
+ end
115
144
 
116
- it "should discard all matches where the given regexp is not matched" do
117
- @session.should have_css("p a", :text => /re[dab]i/i, :count => 1)
118
- @session.should_not have_css("p a", :text => /Red$/)
119
- end
120
- end
121
- end
122
-
123
- describe '#has_no_css?' do
124
- before do
125
- @session.visit('/with_html')
126
- end
127
-
128
- it "should be false if the given selector is on the page" do
129
- @session.should_not have_no_css("p")
130
- @session.should_not have_no_css("p a#foo")
131
- end
132
-
133
- it "should be true if the given selector is not on the page" do
134
- @session.should have_no_css("abbr")
135
- @session.should have_no_css("p a#doesnotexist")
136
- @session.should have_no_css("p.nosuchclass")
137
- end
138
-
139
- it "should respect scopes" do
140
- @session.within "//p[@id='first']" do
141
- @session.should_not have_no_css("a#foo")
142
- @session.should have_no_css("a#red")
143
- end
144
- end
145
-
146
- context "with between" do
147
- it "should be false if the content occurs within the range given" do
148
- @session.should_not have_no_css("p", :between => 1..4)
149
- @session.should_not have_no_css("p a#foo", :between => 1..3)
150
- end
151
-
152
- it "should be true if the content occurs more or fewer times than range" do
153
- @session.should have_no_css("p", :between => 6..11 )
154
- @session.should have_no_css("p a#foo", :between => 4..7)
155
- end
156
-
157
- it "should be true if the content isn't on the page at all" do
158
- @session.should have_no_css("abbr", :between => 1..8)
159
- @session.should have_no_css("p a.doesnotexist", :between => 3..8)
160
- end
161
- end
145
+ context "with between" do
146
+ it "should be false if the content occurs within the range given" do
147
+ @session.should_not have_no_css("p", :between => 1..4)
148
+ @session.should_not have_no_css("p a#foo", :between => 1..3)
149
+ @session.should_not have_no_css("p a.doesnotexist", :between => 0..2)
150
+ end
162
151
 
163
- context "with count" do
164
- it "should be false if the content is on the page the given number of times" do
165
- @session.should_not have_no_css("p", :count => 3)
166
- @session.should_not have_no_css("p a#foo", :count => 1)
167
- end
168
-
169
- it "should be true if the content is on the page the given number of times" do
170
- @session.should have_no_css("p", :count => 6)
171
- @session.should have_no_css("p a#foo", :count => 2)
172
- end
173
-
174
- it "should be true if the content isn't on the page at all" do
175
- @session.should have_no_css("abbr", :count => 2)
176
- @session.should have_no_css("p a.doesnotexist", :count => 1)
177
- end
152
+ it "should be true if the content occurs more or fewer times than range" do
153
+ @session.should have_no_css("p", :between => 6..11 )
154
+ @session.should have_no_css("p a#foo", :between => 4..7)
155
+ @session.should have_no_css("p a.doesnotexist", :between => 3..8)
156
+ end
157
+ end
178
158
 
179
- it "should coerce count to an integer" do
180
- @session.should_not have_no_css("p", :count => "3")
181
- @session.should_not have_no_css("p a#foo", :count => "1")
182
- end
159
+ context "with count" do
160
+ it "should be false if the content is on the page the given number of times" do
161
+ @session.should_not have_no_css("p", :count => 3)
162
+ @session.should_not have_no_css("p a#foo", :count => 1)
163
+ @session.should_not have_no_css("p a.doesnotexist", :count => 0)
183
164
  end
184
165
 
185
- context "with maximum" do
186
- it "should be false when content occurs same or fewer times than given" do
187
- @session.should_not have_no_css("h2.head", :maximum => 5) # edge case
188
- @session.should_not have_no_css("h2", :maximum => 10)
189
- end
166
+ it "should be true if the content is on the page the given number of times" do
167
+ @session.should have_no_css("p", :count => 6)
168
+ @session.should have_no_css("p a#foo", :count => 2)
169
+ @session.should have_no_css("p a.doesnotexist", :count => 1)
170
+ end
190
171
 
191
- it "should be true when content occurs more times than given" do
192
- @session.should have_no_css("h2.head", :maximum => 4) # edge case
193
- @session.should have_no_css("h2", :maximum => 6)
194
- @session.should have_no_css("p", :maximum => 1)
195
- end
172
+ it "should coerce count to an integer" do
173
+ @session.should_not have_no_css("p", :count => "3")
174
+ @session.should_not have_no_css("p a#foo", :count => "1")
175
+ end
176
+ end
196
177
 
197
- it "should be true if the content isn't on the page at all" do
198
- @session.should have_no_css("abbr", :maximum => 5)
199
- @session.should have_no_css("p a.doesnotexist", :maximum => 10)
200
- end
178
+ context "with maximum" do
179
+ it "should be false when content occurs same or fewer times than given" do
180
+ @session.should_not have_no_css("h2.head", :maximum => 5) # edge case
181
+ @session.should_not have_no_css("h2", :maximum => 10)
182
+ @session.should_not have_no_css("p a.doesnotexist", :maximum => 0)
183
+ end
184
+
185
+ it "should be true when content occurs more times than given" do
186
+ @session.should have_no_css("h2.head", :maximum => 4) # edge case
187
+ @session.should have_no_css("h2", :maximum => 6)
188
+ @session.should have_no_css("p", :maximum => 1)
189
+ end
201
190
 
202
- it "should coerce maximum to an integer" do
203
- @session.should_not have_no_css("h2.head", :maximum => "5") # edge case
204
- @session.should_not have_no_css("h2", :maximum => "10")
205
- end
191
+ it "should coerce maximum to an integer" do
192
+ @session.should_not have_no_css("h2.head", :maximum => "5") # edge case
193
+ @session.should_not have_no_css("h2", :maximum => "10")
206
194
  end
195
+ end
207
196
 
208
- context "with minimum" do
209
- it "should be false when content occurs more times than given" do
210
- @session.should_not have_no_css("h2.head", :minimum => 4) # edge case
211
- @session.should_not have_no_css("h2", :minimum => 3)
212
- end
197
+ context "with minimum" do
198
+ it "should be false when content occurs same or more times than given" do
199
+ @session.should_not have_no_css("h2.head", :minimum => 5) # edge case
200
+ @session.should_not have_no_css("h2", :minimum => 3)
201
+ @session.should_not have_no_css("p a.doesnotexist", :minimum => 0)
202
+ end
213
203
 
214
- it "should be true when content occurs fewer times than given" do
215
- @session.should have_no_css("h2.head", :minimum => 6) # edge case
216
- @session.should have_no_css("h2", :minimum => 8)
217
- @session.should have_no_css("p", :minimum => 15)
218
- end
204
+ it "should be true when content occurs fewer times than given" do
205
+ @session.should have_no_css("h2.head", :minimum => 6) # edge case
206
+ @session.should have_no_css("h2", :minimum => 8)
207
+ @session.should have_no_css("p", :minimum => 15)
208
+ @session.should have_no_css("p a.doesnotexist", :minimum => 1)
209
+ end
210
+
211
+ it "should coerce minimum to an integer" do
212
+ @session.should_not have_no_css("h2.head", :minimum => "4") # edge case
213
+ @session.should_not have_no_css("h2", :minimum => "3")
214
+ end
215
+ end
216
+
217
+ context "with text" do
218
+ it "should discard all matches where the given string is not contained" do
219
+ @session.should_not have_no_css("p a", :text => "Redirect", :count => 1)
220
+ @session.should have_no_css("p a", :text => "Doesnotexist")
221
+ end
219
222
 
220
- it "should be true if the content isn't on the page at all" do
221
- @session.should have_no_css("abbr", :minimum => 5)
222
- @session.should have_no_css("p a.doesnotexist", :minimum => 10)
223
- end
224
-
225
- it "should coerce minimum to an integer" do
226
- @session.should_not have_no_css("h2.head", :minimum => "4") # edge case
227
- @session.should_not have_no_css("h2", :minimum => "3")
228
- end
229
- end
230
-
231
- context "with text" do
232
- it "should discard all matches where the given string is not contained" do
233
- @session.should_not have_no_css("p a", :text => "Redirect", :count => 1)
234
- @session.should have_no_css("p a", :text => "Doesnotexist")
235
- end
236
-
237
- it "should discard all matches where the given regexp is not matched" do
238
- @session.should_not have_no_css("p a", :text => /re[dab]i/i, :count => 1)
239
- @session.should have_no_css("p a", :text => /Red$/)
240
- end
223
+ it "should discard all matches where the given regexp is not matched" do
224
+ @session.should_not have_no_css("p a", :text => /re[dab]i/i, :count => 1)
225
+ @session.should have_no_css("p a", :text => /Red$/)
241
226
  end
242
227
  end
243
228
  end