capybara 1.1.4 → 2.0.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.txt → History.md} +138 -0
- data/License.txt +22 -0
- data/README.md +850 -0
- data/lib/capybara/cucumber.rb +2 -5
- data/lib/capybara/driver/base.rb +6 -6
- data/lib/capybara/driver/node.rb +3 -2
- data/lib/capybara/dsl.rb +13 -124
- data/lib/capybara/helpers.rb +33 -0
- data/lib/capybara/node/actions.rb +16 -30
- data/lib/capybara/node/base.rb +56 -13
- data/lib/capybara/node/element.rb +18 -30
- data/lib/capybara/node/finders.rb +28 -90
- data/lib/capybara/node/matchers.rb +121 -73
- data/lib/capybara/node/simple.rb +13 -11
- data/lib/capybara/query.rb +78 -0
- data/lib/capybara/rack_test/browser.rb +27 -39
- data/lib/capybara/rack_test/driver.rb +13 -3
- data/lib/capybara/rack_test/node.rb +31 -2
- data/lib/capybara/result.rb +72 -0
- data/lib/capybara/rspec/features.rb +4 -1
- data/lib/capybara/rspec/matchers.rb +33 -63
- data/lib/capybara/rspec.rb +7 -4
- data/lib/capybara/selector.rb +97 -34
- data/lib/capybara/selenium/driver.rb +15 -62
- data/lib/capybara/selenium/node.rb +14 -21
- data/lib/capybara/server.rb +32 -27
- data/lib/capybara/session.rb +90 -50
- data/lib/capybara/spec/fixtures/another_test_file.txt +1 -0
- data/lib/capybara/spec/public/jquery-ui.js +791 -0
- data/lib/capybara/spec/public/jquery.js +9046 -0
- data/lib/capybara/spec/public/test.js +3 -0
- data/lib/capybara/spec/session/all_spec.rb +61 -59
- data/lib/capybara/spec/session/assert_selector.rb +123 -0
- data/lib/capybara/spec/session/attach_file_spec.rb +72 -55
- data/lib/capybara/spec/session/body_spec.rb +21 -0
- data/lib/capybara/spec/session/check_spec.rb +68 -48
- data/lib/capybara/spec/session/choose_spec.rb +32 -18
- data/lib/capybara/spec/session/click_button_spec.rb +263 -232
- data/lib/capybara/spec/session/click_link_or_button_spec.rb +40 -29
- data/lib/capybara/spec/session/click_link_spec.rb +96 -96
- data/lib/capybara/spec/session/current_url_spec.rb +88 -10
- data/lib/capybara/spec/session/evaluate_script_spec.rb +6 -0
- data/lib/capybara/spec/session/execute_script_spec.rb +7 -0
- data/lib/capybara/spec/session/fill_in_spec.rb +119 -103
- data/lib/capybara/spec/session/find_button_spec.rb +16 -14
- data/lib/capybara/spec/session/find_by_id_spec.rb +16 -14
- data/lib/capybara/spec/session/find_field_spec.rb +23 -21
- data/lib/capybara/spec/session/find_link_spec.rb +15 -14
- data/lib/capybara/spec/session/find_spec.rb +93 -115
- data/lib/capybara/spec/session/first_spec.rb +51 -85
- data/lib/capybara/spec/session/has_button_spec.rb +22 -24
- data/lib/capybara/spec/session/has_css_spec.rb +190 -205
- data/lib/capybara/spec/session/has_field_spec.rb +170 -144
- data/lib/capybara/spec/session/has_link_spec.rb +26 -29
- data/lib/capybara/spec/session/has_select_spec.rb +161 -109
- data/lib/capybara/spec/session/has_selector_spec.rb +94 -100
- data/lib/capybara/spec/session/has_table_spec.rb +22 -88
- data/lib/capybara/spec/session/has_text_spec.rb +195 -0
- data/lib/capybara/spec/session/has_xpath_spec.rb +100 -96
- data/lib/capybara/spec/session/headers.rb +4 -17
- data/lib/capybara/spec/session/html_spec.rb +15 -0
- data/lib/capybara/spec/session/node_spec.rb +205 -0
- data/lib/capybara/spec/session/reset_session_spec.rb +42 -0
- data/lib/capybara/spec/session/response_code.rb +4 -17
- data/lib/capybara/spec/session/save_page_spec.rb +46 -0
- data/lib/capybara/spec/session/screenshot.rb +13 -0
- data/lib/capybara/spec/session/select_spec.rb +99 -88
- data/lib/capybara/spec/session/source_spec.rb +12 -0
- data/lib/capybara/spec/session/text_spec.rb +15 -12
- data/lib/capybara/spec/session/uncheck_spec.rb +22 -17
- data/lib/capybara/spec/session/unselect_spec.rb +69 -58
- data/lib/capybara/spec/session/visit_spec.rb +74 -0
- data/lib/capybara/spec/session/within_frame_spec.rb +31 -0
- data/lib/capybara/spec/session/within_spec.rb +118 -131
- data/lib/capybara/spec/session/within_window_spec.rb +38 -0
- data/lib/capybara/spec/spec_helper.rb +84 -0
- data/lib/capybara/spec/test_app.rb +32 -6
- data/lib/capybara/spec/views/form.erb +12 -10
- data/lib/capybara/spec/views/host_links.erb +2 -2
- data/lib/capybara/spec/views/tables.erb +6 -66
- data/lib/capybara/spec/views/with_html.erb +9 -4
- data/lib/capybara/spec/views/with_js.erb +11 -7
- data/lib/capybara/version.rb +1 -1
- data/lib/capybara.rb +125 -6
- data/spec/basic_node_spec.rb +17 -5
- data/spec/capybara_spec.rb +9 -0
- data/spec/dsl_spec.rb +31 -17
- data/spec/rack_test_spec.rb +157 -0
- data/spec/result_spec.rb +51 -0
- data/spec/rspec/features_spec.rb +19 -2
- data/spec/rspec/matchers_spec.rb +170 -89
- data/spec/rspec_spec.rb +1 -3
- data/spec/selenium_spec.rb +53 -0
- data/spec/server_spec.rb +37 -25
- data/spec/spec_helper.rb +1 -30
- metadata +39 -31
- data/README.rdoc +0 -722
- data/lib/capybara/spec/driver.rb +0 -301
- data/lib/capybara/spec/session/current_host_spec.rb +0 -68
- data/lib/capybara/spec/session/has_content_spec.rb +0 -106
- data/lib/capybara/spec/session/javascript.rb +0 -306
- data/lib/capybara/spec/session.rb +0 -154
- data/lib/capybara/util/save_and_open_page.rb +0 -44
- data/lib/capybara/util/timeout.rb +0 -27
- data/spec/driver/rack_test_driver_spec.rb +0 -89
- data/spec/driver/selenium_driver_spec.rb +0 -37
- data/spec/save_and_open_page_spec.rb +0 -155
- data/spec/session/rack_test_session_spec.rb +0 -55
- data/spec/session/selenium_session_spec.rb +0 -26
- data/spec/string_spec.rb +0 -77
- data/spec/timeout_spec.rb +0 -28
|
@@ -1,192 +1,218 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
Capybara::SpecHelper.spec '#has_field' do
|
|
2
|
+
before { @session.visit('/form') }
|
|
3
|
+
|
|
4
|
+
it "should be true if the field is on the page" do
|
|
5
|
+
@session.should have_field('Dog')
|
|
6
|
+
@session.should have_field('form_description')
|
|
7
|
+
@session.should have_field('Region')
|
|
8
|
+
@session.should have_field(:'Region')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "should be false if the field is not on the page" do
|
|
12
|
+
@session.should_not have_field('Monkey')
|
|
13
|
+
end
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
context 'with value' do
|
|
16
|
+
it "should be true if a field with the given value is on the page" do
|
|
17
|
+
@session.should have_field('First Name', :with => 'John')
|
|
18
|
+
@session.should have_field('Phone', :with => '+1 555 7021')
|
|
19
|
+
@session.should have_field('Street', :with => 'Sesame street 66')
|
|
20
|
+
@session.should have_field('Description', :with => 'Descriptive text goes here')
|
|
13
21
|
end
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@session.should have_field('Street', :with => 'Sesame street 66')
|
|
20
|
-
@session.should have_field('Description', :with => 'Descriptive text goes here')
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "should be false if the given field is not on the page" do
|
|
24
|
-
@session.should_not have_field('First Name', :with => 'Peter')
|
|
25
|
-
@session.should_not have_field('Wrong Name', :with => 'John')
|
|
26
|
-
@session.should_not have_field('Description', :with => 'Monkey')
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it "should be true after the field has been filled in with the given value" do
|
|
30
|
-
@session.fill_in('First Name', :with => 'Jonas')
|
|
31
|
-
@session.should have_field('First Name', :with => 'Jonas')
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it "should be false after the field has been filled in with a different value" do
|
|
35
|
-
@session.fill_in('First Name', :with => 'Jonas')
|
|
36
|
-
@session.should_not have_field('First Name', :with => 'John')
|
|
37
|
-
end
|
|
23
|
+
it "should be false if the given field is not on the page" do
|
|
24
|
+
@session.should_not have_field('First Name', :with => 'Peter')
|
|
25
|
+
@session.should_not have_field('Wrong Name', :with => 'John')
|
|
26
|
+
@session.should_not have_field('Description', :with => 'Monkey')
|
|
38
27
|
end
|
|
39
|
-
end
|
|
40
28
|
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
it "should be true after the field has been filled in with the given value" do
|
|
30
|
+
@session.fill_in('First Name', :with => 'Jonas')
|
|
31
|
+
@session.should have_field('First Name', :with => 'Jonas')
|
|
32
|
+
end
|
|
43
33
|
|
|
44
|
-
it "should be false
|
|
45
|
-
@session.
|
|
46
|
-
@session.should_not
|
|
47
|
-
@session.should_not have_no_field('Region')
|
|
34
|
+
it "should be false after the field has been filled in with a different value" do
|
|
35
|
+
@session.fill_in('First Name', :with => 'Jonas')
|
|
36
|
+
@session.should_not have_field('First Name', :with => 'John')
|
|
48
37
|
end
|
|
38
|
+
end
|
|
49
39
|
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
context 'with type' do
|
|
41
|
+
it "should be true if a field with the given type is on the page" do
|
|
42
|
+
@session.should have_field('First Name', :type => 'text')
|
|
43
|
+
@session.should have_field('Html5 Email', :type => 'email')
|
|
44
|
+
@session.should have_field('Html5 Tel', :type => 'tel')
|
|
52
45
|
end
|
|
53
46
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
@session.should_not have_no_field('Street', :with => 'Sesame street 66')
|
|
59
|
-
@session.should_not have_no_field('Description', :with => 'Descriptive text goes here')
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
it "should be true if the given field is not on the page" do
|
|
63
|
-
@session.should have_no_field('First Name', :with => 'Peter')
|
|
64
|
-
@session.should have_no_field('Wrong Name', :with => 'John')
|
|
65
|
-
@session.should have_no_field('Description', :with => 'Monkey')
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
it "should be false after the field has been filled in with the given value" do
|
|
69
|
-
@session.fill_in('First Name', :with => 'Jonas')
|
|
70
|
-
@session.should_not have_no_field('First Name', :with => 'Jonas')
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it "should be true after the field has been filled in with a different value" do
|
|
74
|
-
@session.fill_in('First Name', :with => 'Jonas')
|
|
75
|
-
@session.should have_no_field('First Name', :with => 'John')
|
|
76
|
-
end
|
|
47
|
+
it "should be false if the given field is not on the page" do
|
|
48
|
+
@session.should_not have_field('First Name', :type => 'email')
|
|
49
|
+
@session.should_not have_field('Html5 Email', :type => 'tel')
|
|
50
|
+
@session.should_not have_field('Description', :type => '')
|
|
77
51
|
end
|
|
78
52
|
end
|
|
53
|
+
end
|
|
79
54
|
|
|
80
|
-
|
|
81
|
-
|
|
55
|
+
Capybara::SpecHelper.spec '#has_no_field' do
|
|
56
|
+
before { @session.visit('/form') }
|
|
82
57
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
58
|
+
it "should be false if the field is on the page" do
|
|
59
|
+
@session.should_not have_no_field('Dog')
|
|
60
|
+
@session.should_not have_no_field('form_description')
|
|
61
|
+
@session.should_not have_no_field('Region')
|
|
62
|
+
end
|
|
87
63
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
64
|
+
it "should be true if the field is not on the page" do
|
|
65
|
+
@session.should have_no_field('Monkey')
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
context 'with value' do
|
|
69
|
+
it "should be false if a field with the given value is on the page" do
|
|
70
|
+
@session.should_not have_no_field('First Name', :with => 'John')
|
|
71
|
+
@session.should_not have_no_field('Phone', :with => '+1 555 7021')
|
|
72
|
+
@session.should_not have_no_field('Street', :with => 'Sesame street 66')
|
|
73
|
+
@session.should_not have_no_field('Description', :with => 'Descriptive text goes here')
|
|
91
74
|
end
|
|
92
75
|
|
|
93
|
-
it "should be
|
|
94
|
-
@session.
|
|
76
|
+
it "should be true if the given field is not on the page" do
|
|
77
|
+
@session.should have_no_field('First Name', :with => 'Peter')
|
|
78
|
+
@session.should have_no_field('Wrong Name', :with => 'John')
|
|
79
|
+
@session.should have_no_field('Description', :with => 'Monkey')
|
|
95
80
|
end
|
|
96
81
|
|
|
97
|
-
it "should be
|
|
98
|
-
@session.
|
|
99
|
-
@session.
|
|
82
|
+
it "should be false after the field has been filled in with the given value" do
|
|
83
|
+
@session.fill_in('First Name', :with => 'Jonas')
|
|
84
|
+
@session.should_not have_no_field('First Name', :with => 'Jonas')
|
|
100
85
|
end
|
|
101
86
|
|
|
102
|
-
it "should be
|
|
103
|
-
@session.
|
|
104
|
-
@session.
|
|
87
|
+
it "should be true after the field has been filled in with a different value" do
|
|
88
|
+
@session.fill_in('First Name', :with => 'Jonas')
|
|
89
|
+
@session.should have_no_field('First Name', :with => 'John')
|
|
105
90
|
end
|
|
91
|
+
end
|
|
106
92
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
@session.
|
|
93
|
+
context 'with type' do
|
|
94
|
+
it "should be false if a field with the given type is on the page" do
|
|
95
|
+
@session.should_not have_no_field('First Name', :type => 'text')
|
|
96
|
+
@session.should_not have_no_field('Html5 Email', :type => 'email')
|
|
97
|
+
@session.should_not have_no_field('Html5 Tel', :type => 'tel')
|
|
110
98
|
end
|
|
111
99
|
|
|
112
|
-
it "should be
|
|
113
|
-
@session.
|
|
114
|
-
@session.
|
|
100
|
+
it "should be true if the given field is not on the page" do
|
|
101
|
+
@session.should have_no_field('First Name', :type => 'email')
|
|
102
|
+
@session.should have_no_field('Html5 Email', :type => 'tel')
|
|
103
|
+
@session.should have_no_field('Description', :type => '')
|
|
115
104
|
end
|
|
116
105
|
end
|
|
106
|
+
end
|
|
117
107
|
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
Capybara::SpecHelper.spec '#has_checked_field?' do
|
|
109
|
+
before { @session.visit('/form') }
|
|
120
110
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
111
|
+
it "should be true if a checked field is on the page" do
|
|
112
|
+
@session.should have_checked_field('gender_female')
|
|
113
|
+
@session.should have_checked_field('Hamster')
|
|
114
|
+
end
|
|
125
115
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
116
|
+
it "should be false if an unchecked field is on the page" do
|
|
117
|
+
@session.should_not have_checked_field('form_pets_cat')
|
|
118
|
+
@session.should_not have_checked_field('Male')
|
|
119
|
+
end
|
|
130
120
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
end
|
|
121
|
+
it "should be false if no field is on the page" do
|
|
122
|
+
@session.should_not have_checked_field('Does Not Exist')
|
|
134
123
|
end
|
|
135
124
|
|
|
136
|
-
|
|
137
|
-
|
|
125
|
+
it "should be true after an unchecked checkbox is checked" do
|
|
126
|
+
@session.check('form_pets_cat')
|
|
127
|
+
@session.should have_checked_field('form_pets_cat')
|
|
128
|
+
end
|
|
138
129
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
130
|
+
it "should be false after a checked checkbox is unchecked" do
|
|
131
|
+
@session.uncheck('form_pets_dog')
|
|
132
|
+
@session.should_not have_checked_field('form_pets_dog')
|
|
133
|
+
end
|
|
143
134
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
135
|
+
it "should be true after an unchecked radio button is chosen" do
|
|
136
|
+
@session.choose('gender_male')
|
|
137
|
+
@session.should have_checked_field('gender_male')
|
|
138
|
+
end
|
|
148
139
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
140
|
+
it "should be false after another radio button in the group is chosen" do
|
|
141
|
+
@session.choose('gender_male')
|
|
142
|
+
@session.should_not have_checked_field('gender_female')
|
|
143
|
+
end
|
|
144
|
+
end
|
|
152
145
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
@session.should_not have_unchecked_field('form_pets_cat')
|
|
156
|
-
end
|
|
146
|
+
Capybara::SpecHelper.spec '#has_no_checked_field?' do
|
|
147
|
+
before { @session.visit('/form') }
|
|
157
148
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
149
|
+
it "should be false if a checked field is on the page" do
|
|
150
|
+
@session.should_not have_no_checked_field('gender_female')
|
|
151
|
+
@session.should_not have_no_checked_field('Hamster')
|
|
152
|
+
end
|
|
162
153
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
154
|
+
it "should be true if an unchecked field is on the page" do
|
|
155
|
+
@session.should have_no_checked_field('form_pets_cat')
|
|
156
|
+
@session.should have_no_checked_field('Male')
|
|
157
|
+
end
|
|
167
158
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
@session.should have_unchecked_field('gender_female')
|
|
171
|
-
end
|
|
159
|
+
it "should be true if no field is on the page" do
|
|
160
|
+
@session.should have_no_checked_field('Does Not Exist')
|
|
172
161
|
end
|
|
162
|
+
end
|
|
173
163
|
|
|
174
|
-
|
|
175
|
-
|
|
164
|
+
Capybara::SpecHelper.spec '#has_unchecked_field?' do
|
|
165
|
+
before { @session.visit('/form') }
|
|
176
166
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
167
|
+
it "should be false if a checked field is on the page" do
|
|
168
|
+
@session.should_not have_unchecked_field('gender_female')
|
|
169
|
+
@session.should_not have_unchecked_field('Hamster')
|
|
170
|
+
end
|
|
181
171
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
172
|
+
it "should be true if an unchecked field is on the page" do
|
|
173
|
+
@session.should have_unchecked_field('form_pets_cat')
|
|
174
|
+
@session.should have_unchecked_field('Male')
|
|
175
|
+
end
|
|
186
176
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
177
|
+
it "should be false if no field is on the page" do
|
|
178
|
+
@session.should_not have_unchecked_field('Does Not Exist')
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
it "should be false after an unchecked checkbox is checked" do
|
|
182
|
+
@session.check('form_pets_cat')
|
|
183
|
+
@session.should_not have_unchecked_field('form_pets_cat')
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
it "should be true after a checked checkbox is unchecked" do
|
|
187
|
+
@session.uncheck('form_pets_dog')
|
|
188
|
+
@session.should have_unchecked_field('form_pets_dog')
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
it "should be false after an unchecked radio button is chosen" do
|
|
192
|
+
@session.choose('gender_male')
|
|
193
|
+
@session.should_not have_unchecked_field('gender_male')
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
it "should be true after another radio button in the group is chosen" do
|
|
197
|
+
@session.choose('gender_male')
|
|
198
|
+
@session.should have_unchecked_field('gender_female')
|
|
190
199
|
end
|
|
191
200
|
end
|
|
192
201
|
|
|
202
|
+
Capybara::SpecHelper.spec '#has_no_unchecked_field?' do
|
|
203
|
+
before { @session.visit('/form') }
|
|
204
|
+
|
|
205
|
+
it "should be true if a checked field is on the page" do
|
|
206
|
+
@session.should have_no_unchecked_field('gender_female')
|
|
207
|
+
@session.should have_no_unchecked_field('Hamster')
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
it "should be false if an unchecked field is on the page" do
|
|
211
|
+
@session.should_not have_no_unchecked_field('form_pets_cat')
|
|
212
|
+
@session.should_not have_no_unchecked_field('Male')
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
it "should be true if no field is on the page" do
|
|
216
|
+
@session.should have_no_unchecked_field('Does Not Exist')
|
|
217
|
+
end
|
|
218
|
+
end
|
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
@session.visit('/with_html')
|
|
6
|
-
end
|
|
1
|
+
Capybara::SpecHelper.spec '#has_link?' do
|
|
2
|
+
before do
|
|
3
|
+
@session.visit('/with_html')
|
|
4
|
+
end
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
it "should be true if the given link is on the page" do
|
|
7
|
+
@session.should have_link('foo')
|
|
8
|
+
@session.should have_link('awesome title')
|
|
9
|
+
@session.should have_link('A link', :href => '/with_simple_html')
|
|
10
|
+
@session.should have_link(:'A link', :href => :'/with_simple_html')
|
|
11
|
+
end
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
end
|
|
13
|
+
it "should be false if the given link is not on the page" do
|
|
14
|
+
@session.should_not have_link('monkey')
|
|
15
|
+
@session.should_not have_link('A link', :href => '/non-existant-href')
|
|
18
16
|
end
|
|
17
|
+
end
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
Capybara::SpecHelper.spec '#has_no_link?' do
|
|
20
|
+
before do
|
|
21
|
+
@session.visit('/with_html')
|
|
22
|
+
end
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
it "should be false if the given link is on the page" do
|
|
25
|
+
@session.should_not have_no_link('foo')
|
|
26
|
+
@session.should_not have_no_link('awesome title')
|
|
27
|
+
@session.should_not have_no_link('A link', :href => '/with_simple_html')
|
|
28
|
+
end
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
end
|
|
30
|
+
it "should be true if the given link is not on the page" do
|
|
31
|
+
@session.should have_no_link('monkey')
|
|
32
|
+
@session.should have_no_link('A link', :href => '/non-existant-href')
|
|
35
33
|
end
|
|
36
34
|
end
|
|
37
|
-
|