Skip to content

Commit

Permalink
Dispatcher is subject to change in RES 3.0
Browse files Browse the repository at this point in the history
There will be no more possibility to pass a class to be instantiated.
Anything responding to a call will be a valid handler.
If you need old behavior define class method:

  ```
  class Handler
    def self.call(*)
      new.call(*)
    end

    def call(*)
    end
  end
  ```

Therefore the rspec tests are adjusted to the future design requirements

Co-authored-by: Szymon Fiedler <[email protected]>
Co-authored-by: Paweł Pacana <[email protected]>
  • Loading branch information
3 people committed Feb 8, 2023
1 parent 77b7338 commit fdc18d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module RSpec
)
)
end
let(:handler) { Handler }
let(:handler) { Handler.new }

def matcher(*expected)
HaveSubscribedToEvents.new(*expected, differ: colorless_differ, phraser: phraser)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ module RSpec
specify { expect(matchers.have_subscribed_to_events(FooEvent, BarEvent)).to be_an(HaveSubscribedToEvents) }

specify do
event_store.subscribe(Handler, to: [FooEvent])
expect(Handler).to matchers.have_subscribed_to_events(FooEvent).in(event_store)
expect(Handler).not_to matchers.have_subscribed_to_events(BarEvent).in(event_store)
handler = Handler.new
event_store.subscribe(handler, to: [FooEvent])
expect(handler).to matchers.have_subscribed_to_events(FooEvent).in(event_store)
expect(handler).not_to matchers.have_subscribed_to_events(BarEvent).in(event_store)
end
end

Expand Down

0 comments on commit fdc18d5

Please sign in to comment.