spec/sprinkle/verify_spec.rb in sprinkle-0.4.2 vs spec/sprinkle/verify_spec.rb in sprinkle-0.5.0.rc1

- old
+ new

@@ -10,13 +10,19 @@ has_file 'my_file.txt' # Check that a file contains a substring file_contains 'my_file.txt', 'A sunny day on the lower east-side' + # Checks that a file matches a local file + matches_local File.join(File.dirname(__FILE__), '..', 'fixtures', 'my_file.txt'), 'my_file.txt' + # Check a directory exists has_directory 'mydir' + # generic test + test "`version` == \"one\"" + # Check for a user has_user "bob" # Check for user with old API user_present "someuser" @@ -71,18 +77,26 @@ it 'should do a grep to see if a file contains a text string' do @verification.commands.should include("grep 'A sunny day on the lower east-side' my_file.txt") end + it 'should do a md5sum to see if a file matches local file' do + @verification.commands.should include(%{[ "X$(md5sum my_file.txt|cut -d\\ -f 1)" = "Xed20d984b757ad5291963389fc209864" ]}) + end + it 'should do a "test -d" on the has_directory check' do @verification.commands.should include('test -d mydir') end - it 'should use id to check for user in group' do - @verification.commands.should include("id -G alf | xargs -n1 echo | grep alien") + it 'should include the generic test' do + @verification.commands.should include("test `version` == \"one\"") end + it 'should use to check for user in group' do + @verification.commands.should include("id -nG alf | xargs -n1 echo | grep alien") + end + it 'should use id to check for user' do @verification.commands.should include('id bob') end it 'should use id to check for user via user_present' do @@ -148,15 +162,15 @@ # To be explicit Sprinkle::OPTIONS[:testing] = false end it 'should call process on the delivery with the correct parameters' do - @delivery.should_receive(:process).with(@name, @verification.commands, [:app], true).once.and_return(true) + @delivery.should_receive(:verify).with(@verification, [:app]).once.and_return(true) @verification.process([:app]) end it 'should raise Sprinkle::VerificationFailed exception when commands fail' do - @delivery.should_receive(:process).once.and_return(false) + @delivery.should_receive(:verify).once.and_return(false) lambda { @verification.process([:app]) }.should raise_error(Sprinkle::VerificationFailed) do |error| error.package.should eql(@package) error.description.should eql('moo') end end