Sha256: 3ba16c2b5c14df54bcb740dd1d21ec805aa0cc971d4d5020ba9b88381a319985

Contents?: true

Size: 878 Bytes

Versions: 4

Compression:

Stored size: 878 Bytes

Contents

require 'spec_helper'
require 'ronin/os'

describe OS do
  subject do
    OS.new(:name => 'Linux', :version => '2.6.11')
  end

  describe "predefine" do
    it "should provide methods for built-in OSes" do
      os = OS.linux

      os.name.should == 'Linux'
    end

    it "should provide methods for creating OSes with versions" do
      os = OS.linux('2.6.11')

      os.version.should == '2.6.11'
    end
  end

  it "should require a name" do
    os = OS.new
    os.should_not be_valid

    os.name = 'test'
    os.should be_valid
  end

  describe "#to_s" do
    it "should convert both the name and version" do
      os = OS.new(:name => 'Linux', :version => '2.6.23')

      os.to_s.should == 'Linux 2.6.23'
    end

    it "should convert just the name if there is no version" do
      os = OS.new(:name => 'Linux')

      os.to_s.should == os.name
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ronin-1.5.0 spec/os_spec.rb
ronin-1.5.0.rc2 spec/os_spec.rb
ronin-1.5.0.rc1 spec/os_spec.rb
ronin-1.4.1 spec/os_spec.rb