Skip to content

Commit

Permalink
testing OS version
Browse files Browse the repository at this point in the history
  • Loading branch information
rderoldan1 committed Jul 25, 2013
1 parent d191a19 commit 255d04d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
7 changes: 3 additions & 4 deletions lib/usagewatch_ext.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
require "usagewatch_ext/version"

module UsagewatchExt
os = RUBY_PLATFORM
text = "OS is not supported in this version."

if os.include? "darwin"
if OS.include? "darwin"
require "usagewatch_ext/mac"
puts "Mac version is under development"
elsif os.include? "linux"
elsif OS.include? "linux"
require "usagewatch/linux"
UsagewatchExt = Usagewatch
elsif os =~ /cygwin|mswin|mingw|bccwin|wince|emx/
elsif OS =~ /cygwin|mswin|mingw|bccwin|wince|emx/
puts "Windows" + text
else
puts "This" + text
Expand Down
1 change: 1 addition & 0 deletions lib/usagewatch_ext/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module UsagewatchExt
VERSION = "0.0.3"
OS = RUBY_PLATFORM
end
3 changes: 1 addition & 2 deletions spec/linux_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
require 'rspec'
require 'spec_helper'

os = RUBY_PLATFORM
if os.include? "linux"
if OS.include? "linux"
describe 'TCPConnectios' do
it 'should TCP Connections Used' do
a = Usagewatch.uw_tcpused
Expand Down
7 changes: 4 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
require 'coveralls'
Coveralls.wear!

os = RUBY_PLATFORM
if os.include? "darwin"
OS = RUBY_PLATFORM
if OS.include? "darwin"
require "usagewatch_ext"
puts "Testing Mac Version"
elsif os.include? "linux"
elsif OS.include? "linux"
require "usagewatch"
puts "Testing Linux Version"
puts `uname -a`
end

RSpec.configure do |config|
Expand Down
18 changes: 18 additions & 0 deletions spec/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,22 @@
a.class.should be(String)
a.should_not be_nil
end
end

describe 'OSVersion' do
it 'should be the OS version' do
a = UsagewatchExt::OS
a.class.should be(String)
a.should_not be_nil
end
end

if OS.include? "linux"
describe 'Version' do
it 'should be the version number of usagewatch' do
a = Usagewatch::VERSION
a.class.should be(String)
a.should_not be_nil
end
end
end

0 comments on commit 255d04d

Please sign in to comment.