Skip to content

Instantly share code, notes, and snippets.

@jackdempsey
Created June 4, 2011 23:27
Show Gist options
  • Save jackdempsey/1008487 to your computer and use it in GitHub Desktop.
Save jackdempsey/1008487 to your computer and use it in GitHub Desktop.
3 describe Comment do
4 it "fires an event when created" do
5 expect { Comment.make! }.to fire_event :comment_left
6 end
7 end
...
38 RSpec::Matchers.define :fire_event do |event_type|
39 match do |actual|
40 expect(&actual).to change{TimelineEvent.count}.by(1)
41 end
42 end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment