Sha256: 26c76a28c435b01ad74d9e5672b38d5d04bf72bd4c79746686c9aa27e5434c4e

Contents?: true

Size: 1.66 KB

Versions: 6

Compression:

Stored size: 1.66 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe "Shutter::OS" do
  before(:each) do
    @os = Shutter::OS.new
  end

  it "should have the correct data for redhat systems" do
    @os.stubs(:version).returns("Red Hat")
    @os.persist_file.should == "/etc/sysconfig/iptables"
    @os.dist.should == "RedHat"
    @os.redhat?.should == true
    @os.centos?.should == true
    @os.fedora?.should == true
  end

  it "should have the correct data for ubuntu systems" do
    @os.stubs(:version).returns("Ubuntu")
    @os.persist_file.should == "/etc/iptables/rules"
    @os.dist.should == "Ubuntu"
    @os.redhat?.should == false
    @os.centos?.should == false
    @os.fedora?.should == false
  end

  it "should have the correct data for debian systems" do
    @os.stubs(:version).returns("Debian")
    @os.persist_file.should == "/etc/iptables/rules"
    @os.dist.should == "Debian"
    @os.redhat?.should == false
    @os.centos?.should == false
    @os.fedora?.should == false
  end

  it "should have the correct data for debian systems" do
    @os.stubs(:version).returns("Unknown")
    @os.persist_file.should == "/tmp/iptables.rules"
    @os.dist.should == "Unknown"
    @os.redhat?.should == false
    @os.centos?.should == false
    @os.fedora?.should == false
  end

  it "should not validate any os except redhat" do
    @os.stubs(:version).returns("Unknown")
    expect { @os.validate! }.to raise_error
    @os.stubs(:version).returns("Ubuntu")
    expect { @os.validate! }.to_not raise_error
    @os.stubs(:version).returns("Debian")
    expect { @os.validate! }.to_not raise_error
    @os.stubs(:version).returns("Red Hat")
    expect { @os.validate! }.to_not raise_error
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shutter-0.2.5 spec/os_spec.rb
shutter-0.2.4 spec/os_spec.rb
shutter-0.2.3 spec/os_spec.rb
shutter-0.2.2 spec/os_spec.rb
shutter-0.2.0 spec/os_spec.rb
shutter-0.1.0 spec/os_spec.rb