Permalink
Browse files

spec and implementation for DstlStore#add

  • Loading branch information...
1 parent e484782 commit 58dff5666a0c5e5e8ee7f5ba096d2912e053c2b5 @bjeanes committed Apr 24, 2012
Showing with 17 additions and 1 deletion.
  1. +2 −0 lib/ghost/store/dscl_store.rb
  2. +15 −1 spec/ghost/store/dscl_store_spec.rb
@@ -40,6 +40,8 @@ def initialize(domain = "localhost")
end
def add(host)
+ Dscl.create(domain, host.name, host.ip)
+ true
end
def all
@@ -54,8 +54,22 @@
end
end
+ describe "#add" do
+ let(:host) { Ghost::Host.new('foo.com', '123.123.123.123') }
+
+ it 'returns true' do
+ store.add(host).should be_true
+ end
+
+ # In order to make this run off OS X and without root, have to use an
+ # expectation... I think?
+ it 'adds the host' do
+ cmd.should_receive(:create).with('localhost', 'foo.com', '123.123.123.123')
+ store.add(host)
+ end
+ end
+
describe "#delete"
- describe "#add"
describe "#delete"
describe "#empty"
end

0 comments on commit 58dff56

Please sign in to comment.