Skip to content

Instantly share code, notes, and snippets.

@mbriggs
Created December 12, 2018 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbriggs/6b2b5590d25723df3c71c0a77e6b8533 to your computer and use it in GitHub Desktop.
Save mbriggs/6b2b5590d25723df3c71c0a77e6b8533 to your computer and use it in GitHub Desktop.
Take 2 on handler fixtures
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