Created
February 4, 2012 03:21
-
-
Save guilherme/1734930 to your computer and use it in GitHub Desktop.
simpler extension to newman applications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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