Skip to content

Commit

Permalink
test that Suite assertions return result.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Dec 10, 2024
1 parent 4748b19 commit 93d33ba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/docs/assertions/pass_fail_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ class SongOperationTest < OperationSpec
end
#:assert-pass-result end

it "returns {result}" do
result = assert_pass( {}, {} )

assert_equal result[:model].title, %(Timebomb)
end

describe "we have {:song}, not {:model}" do
let(:operation) {
Class.new(Song::Operation::Create) do
Expand Down Expand Up @@ -138,6 +144,12 @@ def set_song(ctx, **)
end
#:assert-fail-result end

it "{#assert_fail} returns result" do
result = assert_fail( {duration: 1222, title: ""}, [:title, :duration] )

assert_equal CU.inspect(result[:"contract.default"].errors.messages), %({:title=>[\"must be filled\"], :duration=>[\"must be String\"]})
end

#:wtf
it "fails with missing {title} and invalid {duration}" do
assert_fail?( {duration: 1222, title: ""}, [:title, :duration] )
Expand Down

0 comments on commit 93d33ba

Please sign in to comment.