From d191a195cfd03d7e4fb299c0d1784b912d5e9b27 Mon Sep 17 00:00:00 2001 From: Ruben Espinosa Date: Thu, 25 Jul 2013 00:17:55 -0500 Subject: [PATCH] test coverage increase --- spec/general_spec.rb | 71 ++++++++++++++++++++++++++++++++++++++++++ spec/linux_spec.rb | 67 --------------------------------------- spec/mac_spec.rb | 74 -------------------------------------------- 3 files changed, 71 insertions(+), 141 deletions(-) create mode 100644 spec/general_spec.rb delete mode 100644 spec/mac_spec.rb diff --git a/spec/general_spec.rb b/spec/general_spec.rb new file mode 100644 index 0000000..8385c7f --- /dev/null +++ b/spec/general_spec.rb @@ -0,0 +1,71 @@ +require 'rspec' +require 'spec_helper' + +describe 'IncludeLibrary' do + it 'should include the library' do + a = Usagewatch + a.should be Usagewatch + end +end + +describe 'DiskUsage' do + it "should be the GB of disk used" do + a = Usagewatch.uw_diskused + a.class.should be(Float) + a.should_not be_nil + a.should be >= 0 + end +end + +describe 'CPUUsage' do + it "should be the percentage of cpu used" do + a = Usagewatch.uw_cpuused + a.class.should be(Float) + a.should_not be_nil + a.should be <= 100 + a.should be >= 0 + end +end + +describe 'PercentageDiskUsage' do + it "should be the percentage of GB of disk used" do + a = Usagewatch.uw_diskused_perc + a.class.should be(Float) + a.should_not be_nil + a.should be <= 100 + a.should be >= 0 + end +end + +describe 'LoadAverage' do + it "should be the average load of the past minute" do + a = Usagewatch.uw_load + a.class.should be(Float) + a.should_not be_nil + a.should be >= 0 + end +end + +describe 'TopCPUUsage' do + it "should be an array of top cpu consumption proccesses " do + a = Usagewatch.uw_cputop + a.class.should be(Array ) + a.should_not be_nil + a[0][0].class.should be String + a[0][1].class.should be String + a.count.should be == 10 + end +end + +describe 'TopMEMUsage' do + it "should be an array of top mem consumption proccesses " do + a = Usagewatch.uw_cputop + a.class.should be(Array ) + a.should_not be_nil + a[0][0].class.should be String + a[0][1].class.should be String + a.count.should be == 10 + end +end + + diff --git a/spec/linux_spec.rb b/spec/linux_spec.rb index 1df6227..2987e75 100644 --- a/spec/linux_spec.rb +++ b/spec/linux_spec.rb @@ -3,73 +3,6 @@ os = RUBY_PLATFORM if os.include? "linux" - describe 'IncludeLibrary' do - it 'should include the library' do - a = Usagewatch - a.should be Usagewatch - end - end - - describe 'DiskUsage' do - it "should be the GB of disk used" do - a = Usagewatch.uw_diskused - a.class.should be(Float) - a.should_not be_nil - a.should be >= 0 - end - end - - describe 'CPUUsage' do - it "should be the percentage of cpu used" do - a = Usagewatch.uw_cpuused - a.class.should be(Float) - a.should_not be_nil - a.should be <= 100 - a.should be >= 0 - end - end - - describe 'PercentageDiskUsage' do - it "should be the percentage of GB of disk used" do - a = Usagewatch.uw_diskused_perc - a.class.should be(Float) - a.should_not be_nil - a.should be <= 100 - a.should be >= 0 - end - end - - describe 'LoadAverage' do - it "should be the average load of the past minute" do - a = Usagewatch.uw_load - a.class.should be(Float) - a.should_not be_nil - a.should be >= 0 - end - end - - describe 'TopCPUUsage' do - it "should be an array of top cpu consumption proccesses " do - a = Usagewatch.uw_cputop - a.class.should be(Array ) - a.should_not be_nil - a[0][0].class.should be String - a[0][1].class.should be String - a.count.should be == 10 - end - end - - describe 'TopMEMUsage' do - it "should be an array of top mem consumption proccesses " do - a = Usagewatch.uw_cputop - a.class.should be(Array ) - a.should_not be_nil - a[0][0].class.should be String - a[0][1].class.should be String - a.count.should be == 10 - end - end - describe 'TCPConnectios' do it 'should TCP Connections Used' do a = Usagewatch.uw_tcpused diff --git a/spec/mac_spec.rb b/spec/mac_spec.rb deleted file mode 100644 index 3912038..0000000 --- a/spec/mac_spec.rb +++ /dev/null @@ -1,74 +0,0 @@ -require 'rspec' -require 'spec_helper' - -os = RUBY_PLATFORM -if os.include? "darwin" - describe 'IncludeLibrary' do - it 'should include the library' do - a = Usagewatch - a.should be Usagewatch - end - end - - describe 'DiskUsage' do - it "should be the GB of disk used" do - a = Usagewatch.uw_diskused - a.class.should be(Float) - a.should_not be_nil - a.should be >= 0 - end - end - - describe 'CPUUsage' do - it "should be the percentage of cpu used" do - a = Usagewatch.uw_cpuused - a.class.should be(Float) - a.should_not be_nil - a.should be <= 100 - a.should be >= 0 - end - end - - describe 'PercentageDiskUsage' do - it "should be the percentage of GB of disk used" do - a = Usagewatch.uw_diskused_perc - a.class.should be(Float) - a.should_not be_nil - a.should be <= 100 - a.should be >= 0 - end - end - - describe 'LoadAverage' do - it "should be the average load of the past minute" do - a = Usagewatch.uw_load - a.class.should be(Float) - a.should_not be_nil - a.should be >= 0 - end - end - - describe 'TopCPUUsage' do - it "should be an array of top cpu consumption proccesses " do - a = Usagewatch.uw_cputop - a.class.should be(Array ) - a.should_not be_nil - a[0][0].class.should be String - a[0][1].class.should be String - a.count.should be == 10 - end - end - - describe 'TopMEMUsage' do - it "should be an array of top mem consumption proccesses " do - a = Usagewatch.uw_cputop - a.class.should be(Array ) - a.should_not be_nil - a[0][0].class.should be String - a[0][1].class.should be String - a.count.should be == 10 - end - end - -end -