This file is indexed.

/usr/lib/ruby/vendor_ruby/capybara/spec/session/has_select_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
Capybara::SpecHelper.spec '#has_select?' do
  before { @session.visit('/form') }

  it "should be true if the field is on the page" do
    @session.should have_select('Locale')
    @session.should have_select('form_region')
    @session.should have_select('Languages')
    @session.should have_select(:'Languages')
  end

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

  context 'with selected value' do
    it "should be true if a field with the given value is on the page" do
      @session.should have_select('form_locale', :selected => 'English')
      @session.should have_select('Region', :selected => 'Norway')
      @session.should have_select('Underwear', :selected => [
        'Boxerbriefs', 'Briefs', 'Commando', "Frenchman's Pantalons", 'Long Johns'
      ])
    end

    it "should be false if the given field is not on the page" do
      @session.should_not have_select('Locale', :selected => 'Swedish')
      @session.should_not have_select('Does not exist', :selected => 'John')
      @session.should_not have_select('City', :selected => 'Not there')
      @session.should_not have_select('Underwear', :selected => [
        'Boxerbriefs', 'Briefs', 'Commando', "Frenchman's Pantalons", 'Long Johns', 'Nonexistant'
      ])
      @session.should_not have_select('Underwear', :selected => [
        'Boxerbriefs', 'Briefs', 'Boxers', 'Commando', "Frenchman's Pantalons", 'Long Johns'
      ])
      @session.should_not have_select('Underwear', :selected => [
        'Boxerbriefs', 'Briefs','Commando', "Frenchman's Pantalons"
      ])
    end

    it "should be true after the given value is selected" do
      @session.select('Swedish', :from => 'Locale')
      @session.should have_select('Locale', :selected => 'Swedish')
    end

    it "should be false after a different value is selected" do
      @session.select('Swedish', :from => 'Locale')
      @session.should_not have_select('Locale', :selected => 'English')
    end

    it "should be true after the given values are selected" do
      @session.select('Boxers', :from => 'Underwear')
      @session.should have_select('Underwear', :selected => [
        'Boxerbriefs', 'Briefs', 'Boxers', 'Commando', "Frenchman's Pantalons", 'Long Johns'
      ])
    end

    it "should be false after one of the values is unselected" do
      @session.unselect('Briefs', :from => 'Underwear')
      @session.should_not have_select('Underwear', :selected => [
        'Boxerbriefs', 'Briefs', 'Commando', "Frenchman's Pantalons", 'Long Johns'
      ])
    end
  end

  context 'with exact options' do
    it "should be true if a field with the given options is on the page" do
      @session.should have_select('Region', :options => ['Norway', 'Sweden', 'Finland'])
      @session.should have_select('Tendency', :options => [])
    end

    it "should be false if the given field is not on the page" do
      @session.should_not have_select('Locale', :options => ['Swedish'])
      @session.should_not have_select('Does not exist', :options => ['John'])
      @session.should_not have_select('City', :options => ['London', 'Made up city'])
      @session.should_not have_select('Region', :options => ['Norway', 'Sweden'])
      @session.should_not have_select('Region', :options => ['Norway', 'Norway', 'Norway'])
    end
  end

  context 'with partial options' do
    it "should be true if a field with the given partial options is on the page" do
      @session.should have_select('Region', :with_options => ['Norway', 'Sweden'])
      @session.should have_select('City', :with_options => ['London'])
    end

    it "should be false if a field with the given partial options is not on the page" do
      @session.should_not have_select('Locale', :with_options => ['Uruguayan'])
      @session.should_not have_select('Does not exist', :with_options => ['John'])
      @session.should_not have_select('Region', :with_options => ['Norway', 'Sweden', 'Finland', 'Latvia'])
    end
  end
end

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

  it "should be false if the field is on the page" do
    @session.should_not have_no_select('Locale')
    @session.should_not have_no_select('form_region')
    @session.should_not have_no_select('Languages')
  end

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

  context 'with selected value' do
    it "should be false if a field with the given value is on the page" do
      @session.should_not have_no_select('form_locale', :selected => 'English')
      @session.should_not have_no_select('Region', :selected => 'Norway')
      @session.should_not have_no_select('Underwear', :selected => [
        'Boxerbriefs', 'Briefs', 'Commando', "Frenchman's Pantalons", 'Long Johns'
      ])
    end

    it "should be true if the given field is not on the page" do
      @session.should have_no_select('Locale', :selected => 'Swedish')
      @session.should have_no_select('Does not exist', :selected => 'John')
      @session.should have_no_select('City', :selected => 'Not there')
      @session.should have_no_select('Underwear', :selected => [
        'Boxerbriefs', 'Briefs', 'Commando', "Frenchman's Pantalons", 'Long Johns', 'Nonexistant'
      ])
      @session.should have_no_select('Underwear', :selected => [
        'Boxerbriefs', 'Briefs', 'Boxers', 'Commando', "Frenchman's Pantalons", 'Long Johns'
      ])
      @session.should have_no_select('Underwear', :selected => [
        'Boxerbriefs', 'Briefs','Commando', "Frenchman's Pantalons"
      ])
    end

    it "should be false after the given value is selected" do
      @session.select('Swedish', :from => 'Locale')
      @session.should_not have_no_select('Locale', :selected => 'Swedish')
    end

    it "should be true after a different value is selected" do
      @session.select('Swedish', :from => 'Locale')
      @session.should have_no_select('Locale', :selected => 'English')
    end

    it "should be false after the given values are selected" do
      @session.select('Boxers', :from => 'Underwear')
      @session.should_not have_no_select('Underwear', :selected => [
        'Boxerbriefs', 'Briefs', 'Boxers', 'Commando', "Frenchman's Pantalons", 'Long Johns'
      ])
    end

    it "should be true after one of the values is unselected" do
      @session.unselect('Briefs', :from => 'Underwear')
      @session.should have_no_select('Underwear', :selected => [
        'Boxerbriefs', 'Briefs', 'Commando', "Frenchman's Pantalons", 'Long Johns'
      ])
    end
  end

  context 'with exact options' do
    it "should be false if a field with the given options is on the page" do
      @session.should_not have_no_select('Region', :options => ['Norway', 'Sweden', 'Finland'])
    end

    it "should be true if the given field is not on the page" do
      @session.should have_no_select('Locale', :options => ['Swedish'])
      @session.should have_no_select('Does not exist', :options => ['John'])
      @session.should have_no_select('City', :options => ['London', 'Made up city'])
      @session.should have_no_select('Region', :options => ['Norway', 'Sweden'])
      @session.should have_no_select('Region', :options => ['Norway', 'Norway', 'Norway'])
    end
  end

  context 'with partial options' do
    it "should be false if a field with the given partial options is on the page" do
      @session.should_not have_no_select('Region', :with_options => ['Norway', 'Sweden'])
      @session.should_not have_no_select('City', :with_options => ['London'])
    end

    it "should be true if a field with the given partial options is not on the page" do
      @session.should have_no_select('Locale', :with_options => ['Uruguayan'])
      @session.should have_no_select('Does not exist', :with_options => ['John'])
      @session.should have_no_select('Region', :with_options => ['Norway', 'Sweden', 'Finland', 'Latvia'])
    end
  end
end