Skip to content

Commit

Permalink
extract assert_exposes unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Jan 22, 2025
1 parent 2a3b7d6 commit 0157e18
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/assert_exposes_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require "test_helper"

class AssertExposesTest < Minitest::Spec
# TODO: should we test the "meat" of these assertions here?
it "#assert_exposes" do
test =
Class.new(Test) do
include Trailblazer::Test::Assertion::AssertExposes
Memo = Trailblazer::Test::Testing::Memo

# 01
it do
memo = Memo.new(title: "TODO", id: 1)

assert_exposes memo,
id: 1,
title: "TODO"

@result = {}
end

# 02
# fails
it do
memo = Memo.new(title: "TODO", id: 1)

assert_exposes memo,
title: "TODO",
content: "this is wrong"
end
end

assert_test_case_passes(test, "01", nil)
assert_test_case_fails(test, "02", %(#<Minitest::Assertion: Property [content] mismatch.
Expected: "this is wrong"
Actual: nil>))
end
end

0 comments on commit 0157e18

Please sign in to comment.