Skip to content

Commit acee4d3

Browse files
committed
Change to simplified test setup
* These hooks can just be moved to boot time code without semantic difference reducing indirection. * Makes the effect of the hooks be persisted between parallel exeuction on mutation runs and regular test runs.
1 parent 124db94 commit acee4d3

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

rails_application/test/test_helper.rb

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,12 @@
77

88
class InMemoryTestCase < ActiveSupport::TestCase
99

10-
def before_setup
11-
result = super
12-
@previous_event_store = Rails.configuration.event_store
13-
@previous_command_bus = Rails.configuration.command_bus
14-
Rails.configuration.event_store = Infra::EventStore.in_memory
15-
Rails.configuration.command_bus = Arkency::CommandBus.new
16-
17-
Configuration.new.call(
18-
Rails.configuration.event_store, Rails.configuration.command_bus
19-
)
20-
result
21-
end
10+
Rails.configuration.event_store = Infra::EventStore.in_memory
11+
Rails.configuration.command_bus = Arkency::CommandBus.new
2212

23-
def before_teardown
24-
result = super
25-
Rails.configuration.event_store = @previous_event_store
26-
Rails.configuration.command_bus = @previous_command_bus
27-
result
28-
end
13+
Configuration.new.call(
14+
Rails.configuration.event_store, Rails.configuration.command_bus
15+
)
2916

3017
def run_command(command)
3118
Rails.configuration.command_bus.call(command)

0 commit comments

Comments
 (0)