Skip to content

Instantly share code, notes, and snippets.

@guilherme
Created February 4, 2012 03:21
Show Gist options
  • Save guilherme/1734930 to your computer and use it in GitHub Desktop.
Save guilherme/1734930 to your computer and use it in GitHub Desktop.
simpler extension to newman applications
module Newman
module ActAsPingPong
def self.extended(klass)
klass.instance_eval do
to(:tag, "ping") do
respond(:subject => "pong")
end
end
end
end
end
module Newman
module Examples
SimpleList = Newman::Application.new do
extend ActAsPingPong
# ...
end
end
end
describe "SimpleList" do
it "could be extended by PingPongApplication" do
mailer.deliver_message(:to => "[email protected]")
server.tick(Newman::Examples::SimpleList)
messages = mailer.messages
messages.first.subject.must_equal("pong")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment