This file is indexed.

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

  it "should find all elements using the given locator" do
    @session.all('//p').should have(3).elements
    @session.all('//h1').first.text.should == 'This is a test'
    @session.all("//input[@id='test_field']").first[:value].should == 'monkey'
  end

  it "should return an empty array when nothing was found" do
    @session.all('//div[@id="nosuchthing"]').should be_empty
  end

  it "should accept an XPath instance" do
    @session.visit('/form')
    @xpath = XPath::HTML.fillable_field('Name')
    @result = @session.all(@xpath).map { |r| r.value }
    @result.should include('Smith', 'John', 'John Smith')
  end

  it "should raise an error when given invalid options" do
    expect { @session.all('//p', :schmoo => "foo") }.to raise_error(ArgumentError)
  end

  context "with css selectors" do
    it "should find all elements using the given selector" do
      @session.all(:css, 'h1').first.text.should == 'This is a test'
      @session.all(:css, "input[id='test_field']").first[:value].should == 'monkey'
    end

    it "should find all elements when given a list of selectors" do
      @session.all(:css, 'h1, p').should have(4).elements
    end
  end

  context "with xpath selectors" do
    it "should find the first element using the given locator" do
      @session.all(:xpath, '//h1').first.text.should == 'This is a test'
      @session.all(:xpath, "//input[@id='test_field']").first[:value].should == 'monkey'
    end
  end

  context "with css as default selector" do
    before { Capybara.default_selector = :css }
    it "should find the first element using the given locator" do
      @session.all('h1').first.text.should == 'This is a test'
      @session.all("input[id='test_field']").first[:value].should == 'monkey'
    end
  end

  context "with visible filter" do
    it "should only find visible nodes when true" do
      @session.all(:css, "a.simple", :visible => true).should have(1).elements
    end

    it "should find nodes regardless of whether they are invisible when false" do
      @session.all(:css, "a.simple", :visible => false).should have(2).elements
    end

    it "should default to Capybara.ignore_hidden_elements" do
      Capybara.ignore_hidden_elements = true
      @session.all(:css, "a.simple").should have(1).elements
      Capybara.ignore_hidden_elements = false
      @session.all(:css, "a.simple").should have(2).elements
    end
  end

  context "within a scope" do
    before do
      @session.visit('/with_scope')
    end

    it "should find any element using the given locator" do
      @session.within(:xpath, "//div[@id='for_bar']") do
        @session.all('.//li').should have(2).elements
      end
    end
  end
end