Skip to content

Instantly share code, notes, and snippets.

@mbriggs mbriggs/fixture.rb
Created Dec 12, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.