This file is indexed.

/usr/lib/ruby/vendor_ruby/capybara/spec/session/has_field_spec.rb is in ruby-capybara 2.2.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
Capybara::SpecHelper.spec '#has_field' do
  before { @session.visit('/form') }

  it "should be true if the field is on the page" do
    @session.should have_field('Dog')
    @session.should have_field('form_description')
    @session.should have_field('Region')
    @session.should have_field(:'Region')
  end

  it "should be false if the field is not on the page" do
    @session.should_not have_field('Monkey')
  end

  context 'with value' do
    it "should be true if a field with the given value is on the page" do
      @session.should have_field('First Name', :with => 'John')
      @session.should have_field('Phone', :with => '+1 555 7021')
      @session.should have_field('Street', :with => 'Sesame street 66')
      @session.should have_field('Description', :with => 'Descriptive text goes here')
    end

    it "should be false if the given field is not on the page" do
      @session.should_not have_field('First Name', :with => 'Peter')
      @session.should_not have_field('Wrong Name', :with => 'John')
      @session.should_not have_field('Description', :with => 'Monkey')
    end

    it "should be true after the field has been filled in with the given value" do
      @session.fill_in('First Name', :with => 'Jonas')
      @session.should have_field('First Name', :with => 'Jonas')
    end

    it "should be false after the field has been filled in with a different value" do
      @session.fill_in('First Name', :with => 'Jonas')
      @session.should_not have_field('First Name', :with => 'John')
    end
  end

  context 'with type' do
    it "should be true if a field with the given type is on the page" do
      @session.should have_field('First Name', :type => 'text')
      @session.should have_field('Html5 Email', :type => 'email')
      @session.should have_field('Html5 Tel', :type => 'tel')
      @session.should have_field('Description', :type => 'textarea')
      @session.should have_field('Languages', :type => 'select')
    end

    it "should be false if the given field is not on the page" do
      @session.should_not have_field('First Name', :type => 'textarea')
      @session.should_not have_field('Html5 Email', :type => 'tel')
      @session.should_not have_field('Description', :type => '')
      @session.should_not have_field('Description', :type => 'email')
      @session.should_not have_field('Languages', :type => 'textarea')
    end
  end
end

Capybara::SpecHelper.spec '#has_no_field' do
  before { @session.visit('/form') }

  it "should be false if the field is on the page" do
    @session.should_not have_no_field('Dog')
    @session.should_not have_no_field('form_description')
    @session.should_not have_no_field('Region')
  end

  it "should be true if the field is not on the page" do
    @session.should have_no_field('Monkey')
  end

  context 'with value' do
    it "should be false if a field with the given value is on the page" do
      @session.should_not have_no_field('First Name', :with => 'John')
      @session.should_not have_no_field('Phone', :with => '+1 555 7021')
      @session.should_not have_no_field('Street', :with => 'Sesame street 66')
      @session.should_not have_no_field('Description', :with => 'Descriptive text goes here')
    end

    it "should be true if the given field is not on the page" do
      @session.should have_no_field('First Name', :with => 'Peter')
      @session.should have_no_field('Wrong Name', :with => 'John')
      @session.should have_no_field('Description', :with => 'Monkey')
    end

    it "should be false after the field has been filled in with the given value" do
      @session.fill_in('First Name', :with => 'Jonas')
      @session.should_not have_no_field('First Name', :with => 'Jonas')
    end

    it "should be true after the field has been filled in with a different value" do
      @session.fill_in('First Name', :with => 'Jonas')
      @session.should have_no_field('First Name', :with => 'John')
    end
  end

  context 'with type' do
    it "should be false if a field with the given type is on the page" do
      @session.should_not have_no_field('First Name', :type => 'text')
      @session.should_not have_no_field('Html5 Email', :type => 'email')
      @session.should_not have_no_field('Html5 Tel', :type => 'tel')
      @session.should_not have_no_field('Description', :type => 'textarea')
      @session.should_not have_no_field('Languages', :type => 'select')
    end

    it "should be true if the given field is not on the page" do
      @session.should have_no_field('First Name', :type => 'textarea')
      @session.should have_no_field('Html5 Email', :type => 'tel')
      @session.should have_no_field('Description', :type => '')
      @session.should have_no_field('Description', :type => 'email')
      @session.should have_no_field('Languages', :type => 'textarea')
    end
  end
end

Capybara::SpecHelper.spec '#has_checked_field?' do
  before { @session.visit('/form') }

  it "should be true if a checked field is on the page" do
    @session.should have_checked_field('gender_female')
    @session.should have_checked_field('Hamster')
  end

  it "should be true for disabled checkboxes if :disabled => true" do
    @session.should have_checked_field('Disabled Checkbox', :disabled => true)
  end

  it "should be false if an unchecked field is on the page" do
    @session.should_not have_checked_field('form_pets_cat')
    @session.should_not have_checked_field('Male')
  end

  it "should be false if no field is on the page" do
    @session.should_not have_checked_field('Does Not Exist')
  end

  it "should be false for disabled checkboxes by default" do
    @session.should_not have_checked_field('Disabled Checkbox')
  end

  it "should be false for disabled checkboxes if :disabled => false" do
    @session.should_not have_checked_field('Disabled Checkbox', :disabled => false)
  end

  it "should be true after an unchecked checkbox is checked" do
    @session.check('form_pets_cat')
    @session.should have_checked_field('form_pets_cat')
  end

  it "should be false after a checked checkbox is unchecked" do
    @session.uncheck('form_pets_dog')
    @session.should_not have_checked_field('form_pets_dog')
  end

  it "should be true after an unchecked radio button is chosen" do
    @session.choose('gender_male')
    @session.should have_checked_field('gender_male')
  end

  it "should be false after another radio button in the group is chosen" do
    @session.choose('gender_male')
    @session.should_not have_checked_field('gender_female')
  end
end

Capybara::SpecHelper.spec '#has_no_checked_field?' do
  before { @session.visit('/form') }

  it "should be false if a checked field is on the page" do
    @session.should_not have_no_checked_field('gender_female')
    @session.should_not have_no_checked_field('Hamster')
  end

  it "should be false for disabled checkboxes if :disabled => true" do
    @session.should_not have_no_checked_field('Disabled Checkbox', :disabled => true)
  end

  it "should be true if an unchecked field is on the page" do
    @session.should have_no_checked_field('form_pets_cat')
    @session.should have_no_checked_field('Male')
  end

  it "should be true if no field is on the page" do
    @session.should have_no_checked_field('Does Not Exist')
  end

  it "should be true for disabled checkboxes by default" do
    @session.should have_no_checked_field('Disabled Checkbox')
  end

  it "should be true for disabled checkboxes if :disabled => false" do
    @session.should have_no_checked_field('Disabled Checkbox', :disabled => false)
  end
end

Capybara::SpecHelper.spec '#has_unchecked_field?' do
  before { @session.visit('/form') }

  it "should be false if a checked field is on the page" do
    @session.should_not have_unchecked_field('gender_female')
    @session.should_not have_unchecked_field('Hamster')
  end

  it "should be true if an unchecked field is on the page" do
    @session.should have_unchecked_field('form_pets_cat')
    @session.should have_unchecked_field('Male')
  end

  it "should be true for disabled unchecked fields if :disabled => true" do
    @session.should have_unchecked_field('Disabled Unchecked Checkbox', :disabled => true)
  end

  it "should be false if no field is on the page" do
    @session.should_not have_unchecked_field('Does Not Exist')
  end

  it "should be false for disabled unchecked fields by default" do
    @session.should_not have_unchecked_field('Disabled Unchecked Checkbox')
  end

  it "should be false for disabled unchecked fields if :disabled => false" do
    @session.should_not have_unchecked_field('Disabled Unchecked Checkbox', :disabled => false)
  end

  it "should be false after an unchecked checkbox is checked" do
    @session.check('form_pets_cat')
    @session.should_not have_unchecked_field('form_pets_cat')
  end

  it "should be true after a checked checkbox is unchecked" do
    @session.uncheck('form_pets_dog')
    @session.should have_unchecked_field('form_pets_dog')
  end

  it "should be false after an unchecked radio button is chosen" do
    @session.choose('gender_male')
    @session.should_not have_unchecked_field('gender_male')
  end

  it "should be true after another radio button in the group is chosen" do
    @session.choose('gender_male')
    @session.should have_unchecked_field('gender_female')
  end
end

Capybara::SpecHelper.spec '#has_no_unchecked_field?' do
  before { @session.visit('/form') }

  it "should be true if a checked field is on the page" do
    @session.should have_no_unchecked_field('gender_female')
    @session.should have_no_unchecked_field('Hamster')
  end

  it "should be false if an unchecked field is on the page" do
    @session.should_not have_no_unchecked_field('form_pets_cat')
    @session.should_not have_no_unchecked_field('Male')
  end

  it "should be false for disabled unchecked fields if :disabled => true" do
    @session.should_not have_no_unchecked_field('Disabled Unchecked Checkbox', :disabled => true)
  end

  it "should be true if no field is on the page" do
    @session.should have_no_unchecked_field('Does Not Exist')
  end

  it "should be true for disabled unchecked fields by default" do
    @session.should have_no_unchecked_field('Disabled Unchecked Checkbox')
  end

  it "should be true for disabled unchecked fields if :disabled => false" do
    @session.should have_no_unchecked_field('Disabled Unchecked Checkbox', :disabled => false)
  end
end