This file is indexed.

/usr/lib/ruby/vendor_ruby/capybara/spec/session/accept_prompt_spec.rb is in ruby-capybara 2.5.0-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
Capybara::SpecHelper.spec '#accept_prompt', :requires => [:modals] do
  before do
    @session.visit('/with_js')
  end

  it "should accept the prompt with no message" do
    @session.accept_prompt do
      @session.click_link('Open prompt')
    end
    expect(@session).to have_xpath("//a[@id='open-prompt' and @response='']")
  end

  it "should return the message presented" do
    message = @session.accept_prompt do
      @session.click_link('Open prompt')
    end
    expect(message).to eq('Prompt opened')
  end
  
  it "should accept the prompt with a response" do
    @session.accept_prompt with: 'the response' do
      @session.click_link('Open prompt')
    end
    expect(@session).to have_xpath("//a[@id='open-prompt' and @response='the response']")
  end
  
  it "should accept the prompt if the message matches" do
    @session.accept_prompt 'Prompt opened', with: 'matched' do
      @session.click_link('Open prompt')
    end
    expect(@session).to have_xpath("//a[@id='open-prompt' and @response='matched']")
  end
  
  it "should not accept the prompt if the message doesn't match" do
    expect do
      @session.accept_prompt 'Incorrect Text', with: 'not matched' do
        @session.click_link('Open prompt')
      end
    end.to raise_error(Capybara::ModalNotFound)
  end
  

  it "should return the message presented" do
    message = @session.accept_prompt with: 'the response' do
      @session.click_link('Open prompt')
    end
    expect(message).to eq('Prompt opened')
  end
end