Permalink
Browse files

First working specs (minor), refs #87

  • Loading branch information...
1 parent 7f80159 commit 7bf2262a196334207d12dd94687571c2864cf5a7 @akzhan akzhan committed Aug 28, 2011
Showing with 32 additions and 1 deletion.
  1. +1 −1 .rspec
  2. +28 −0 spec/lib/bluepill/system_spec.rb
  3. +3 −0 spec/spec_helper.rb
View
2 .rspec
@@ -1 +1 @@
--c -f progress
+-r ./spec/spec_helper.rb -c -f progress
View
28 spec/lib/bluepill/system_spec.rb
@@ -0,0 +1,28 @@
+describe Bluepill::System do
+ describe :pid_alive? do
+ it "should be true if process responds to zero signal" do
+ mock(::Process).kill(0, 555)
+ Bluepill::System.should be_pid_alive(555)
+ end
+
+ it "should be false if process throws exception on zero signal" do
+ mock(::Process).kill(0, 555) { raise Errno::ESRCH.new }
+ Bluepill::System.should_not be_pid_alive(555)
+ end
+ end
+
+ describe :store do
+ it "should be Hash" do
+ Bluepill::System.store.should be_kind_of(Hash)
+ end
+
+ it "should return same Hash or every call" do
+ Bluepill::System.store.should be_equal(Bluepill::System.store)
+ end
+
+ it "should store assigned pairs" do
+ Bluepill::System.store[:somekey] = 10
+ Bluepill::System.store[:somekey].should be_eql(10)
+ end
+ end
+end
View
3 spec/spec_helper.rb
@@ -2,7 +2,10 @@
require 'faker'
require 'rspec/core'
+$LOAD_PATH.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
+
RSpec.configure do |conf|
conf.mock_with :rr
end
+require 'bluepill'

0 comments on commit 7bf2262

Please sign in to comment.