Skip to content

Commit

Permalink
First working specs (minor), refs #87
Browse files Browse the repository at this point in the history
  • Loading branch information
akzhan committed Aug 28, 2011
1 parent 7f80159 commit 7bf2262
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .rspec
@@ -1 +1 @@
-c -f progress
-r ./spec/spec_helper.rb -c -f progress
28 changes: 28 additions & 0 deletions 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
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
Expand Up @@ -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.