spec/lib/shamu/events/support_spec.rb in shamu-0.0.17 vs spec/lib/shamu/events/support_spec.rb in shamu-0.0.18

- old
+ new

@@ -1,7 +1,21 @@ require "spec_helper" +module EventsSupportSpec + class Service < Shamu::Services::Service + include Shamu::Events::Support + + public :event! + end + + module Events + class Boom < Shamu::Events::Message + attribute :name + end + end +end + describe Shamu::Events::Support do describe "#event_channel" do { "Users::UsersService" => "users", "Users::ProfileService" => "users/profile", @@ -25,20 +39,18 @@ end describe "event!" do hunt( :events_service, Shamu::Events::EventsService ) - let( :klass ) do - Class.new( Shamu::Services::Service ) do - include Shamu::Events::Support + let( :service ) { scorpion.new EventsSupportSpec::Service } - public :event! - end - end - let( :service ) { scorpion.new klass } - it "publishes message to events_service" do expect( events_service ).to receive( :publish ) service.event! Shamu::Events::Message.new end + + it "creates message from attributes" do + expect( events_service ).to receive( :publish ) + service.event! :boom, name: "Me" + end end -end \ No newline at end of file +end