Created
December 12, 2018 23:55
-
-
Save mbriggs/6b2b5590d25723df3c71c0a77e6b8533 to your computer and use it in GitHub Desktop.
Take 2 on handler fixtures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative "../../automated_init" | |
context "Handle Commands" do | |
context "Added" do | |
context "Writes Added event" do | |
id = Controls::Account.id | |
account = Controls::Account::New.example | |
add = Controls::Commands::Add.example | |
time = Controls::Time::Processed.example | |
fixture = Fixtures::Handler.build( | |
handler: Handlers::Commands, | |
store_entity: account, | |
set_now: time, | |
) | |
fixture.(add) | |
fixture.assert_written(Messages::Events::Added) do |written| | |
written.assert_follows(enable) do |follows| | |
follows.assert_copies( | |
:account_id, :currency, | |
:name, :user, :time | |
) | |
follows.assert_message_sequence_set | |
end | |
written.assert_stream_name("account-#{id}") | |
written.assert_expected_version(:no_stream) | |
written.assert_value_set(processed_time: time) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment