Sha256: 9100557a227b7dfedb5721f7f4683e7074542257384b1843976047e9c394f3b7

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

require 'stringio'

describe LinuxAdmin::EtcIssue do
  subject { described_class.instance }
  before do
    # Reset the singleton so subsequent tests get a new instance
    subject.refresh
  end

  it "should not find the phrase when the file is missing" do
    expect(File).to receive(:exist?).with('/etc/issue').at_least(:once).and_return(false)
    expect(subject).not_to include("phrase")
  end

  it "should not find phrase when the file is empty" do
    etc_issue_contains("")
    expect(subject).not_to include("phrase")
  end

  it "should not find phrase when the file has a different phrase" do
    etc_issue_contains("something\nelse")
    expect(subject).not_to include("phrase")
  end

  it "should find phrase in same case" do
    etc_issue_contains("phrase")
    expect(subject).to include("phrase")
  end

  it "should find upper phrase in file" do
    etc_issue_contains("PHRASE\nother")
    expect(subject).to include("phrase")
  end

  it "should find phrase when searching with upper" do
    etc_issue_contains("other\nphrase")
    expect(subject).to include("PHRASE")
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
linux_admin-0.11.1 spec/etc_issue_spec.rb
linux_admin-0.11.0 spec/etc_issue_spec.rb
linux_admin-0.10.1 spec/etc_issue_spec.rb
linux_admin-0.10.0 spec/etc_issue_spec.rb
linux_admin-0.9.4 spec/etc_issue_spec.rb
linux_admin-0.9.3 spec/etc_issue_spec.rb
linux_admin-0.9.2 spec/etc_issue_spec.rb