Skip to content

Commit

Permalink
Defining the mediation lingo
Browse files Browse the repository at this point in the history
  • Loading branch information
coffeeaddict committed Oct 30, 2012
1 parent 288cc48 commit 9ab238d
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions spec/kindergarten/sandbox_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,57 @@
@sandbox.purpose.should be_kind_of(Hash)
end
end

describe :Mediation do
before(:each) do
@sandbox = Kindergarten::Sandbox.new(:kid)
@sandbox.load_module(SpecPerimeter)
end

describe :subscribe do
it "should subscribe the sandbox to events" do
evented = false
@sandbox.subscribe(:testing, :event) do
evented = true
end

expect {
@sandbox.testing.fire(:event)
}.to change { evented }
end
end

describe :unsubscribe do
it "should unsubscribe the sandbox from events" do
evented = 0
@sandbox.subscribe(:testing, :event) do
evented += 1
end

expect {
@sandbox.testing.fire(:event)
}.to change { evented }

@sanbox.unsubscribe(:testing, :event)

expect {
@sandbox.testing.fire(:event)
}.to_not change { evented }
end
end

describe :Broadcast do
it "should broadcast events" do
evented = 0
@sandbox.broadcast_publish do |event|
evented += 1
end

expect {
@sandbox.testing.fire
}.to change { evented }
end
end

end
end

0 comments on commit 9ab238d

Please sign in to comment.