This file is indexed.

/usr/lib/ruby/vendor_ruby/capybara/spec/session/find_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
Capybara::SpecHelper.spec '#find_field' do
  before do
    @session.visit('/form')
  end

  it "should find any field" do
    @session.find_field('Dog').value.should == 'dog'
    @session.find_field('form_description').text.should == 'Descriptive text goes here'
    @session.find_field('Region')[:name].should == 'form[region]'
  end

  it "casts to string" do
    @session.find_field(:'Dog').value.should == 'dog'
  end

  it "should raise error if the field doesn't exist" do
    expect do
      @session.find_field('Does not exist')
    end.to raise_error(Capybara::ElementNotFound)
  end

  it "should be aliased as 'field_labeled' for webrat compatibility" do
    @session.field_labeled('Dog').value.should == 'dog'
    expect do
      @session.field_labeled('Does not exist')
    end.to raise_error(Capybara::ElementNotFound)
  end

  context "with :exact option" do
    it "should accept partial matches when false" do
      @session.find_field("Explanation", :exact => false)[:name].should == "form[name_explanation]"
    end

    it "should not accept partial matches when true" do
      expect do
        @session.find_field("Explanation", :exact => true)
      end.to raise_error(Capybara::ElementNotFound)
    end
  end

  context "with :disabled option" do
    it "should find disabled fields when true" do
      @session.find_field("Disabled Checkbox", :disabled => true)[:name].should == "form[disabled_checkbox]"
    end

    it "should not find disabled fields when false" do
      expect do
        @session.find_field("Disabled Checkbox", :disabled => false)
      end.to raise_error(Capybara::ElementNotFound)
    end

    it "should not find disabled fields by default" do
      expect do
        @session.find_field("Disabled Checkbox")
      end.to raise_error(Capybara::ElementNotFound)
    end
  end
end