test/test_nested.rb in pork-0.9.0 vs test/test_nested.rb in pork-0.9.1

- old
+ new

@@ -42,16 +42,54 @@ paste would do t.should.eq true end + + describe 'C' do + paste + end end would 'skip' do skip should.flunk end end would 'also work on top-level' do true.should.eq true +end + +describe 'Pork.inspect_failure' do + would 'hash' do + Pork.inspect_failure_auto( + {:b => 1, :a => 0}, :==, [{:a => 1, :b => 0}], false). + should.eq '{:a=>0, :b=>1}.==({:a=>1, :b=>0}) to return true' + end + + would 'newline' do + obj, arg = 'a'*80, 'b'*80 + Pork.inspect_failure_auto(obj, :==, [arg], true). + should.eq "\n#{obj.inspect}.==(\n#{arg.inspect}) to return false" + end + + would 'diff' do + s = File.read(__FILE__) + n = s.count("\n") + Pork.inspect_failure_auto(s, :==, ["#{s}b\n"], true). + should.eq "String#==(\n#{n}a#{n+1}\n> b\n) to return false" + end +end + +describe 'should(message)' do + would 'show message' do + should.raise(Pork::Failure){ should('nnf').satisfy('qoo'){ false } }. + message.should.eq "Expect qoo\nnnf" + end + + would 'show lazy message' do + should.raise(Pork::Failure) do + should(nil, lambda{'nnf'}).satisfy(nil, lambda{'qoo'}){ false } + end.message.should.eq "Expect qoo\nnnf" + end end