Created
January 9, 2009 18:01
-
-
Save auser/45199 to your computer and use it in GitHub Desktop.
This file contains 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
require "rubygems" | |
class Object | |
def returning(receiver) | |
yield receiver | |
receiver | |
end | |
end | |
module AnotherModule | |
def say_hello(obj) | |
puts "Hello from AnotherModule #{obj}" | |
end | |
end | |
class UserFlowsTest# < ActionController::IntegrationTest | |
def test_user_flow_from_signup_thru_first_trade | |
new_session do |parent| | |
hello_from_another_module parent | |
end | |
end | |
def new_session | |
returning self do |sess| | |
sess.extend(TestingDSL) | |
yield sess if block_given? | |
end | |
end | |
private | |
module TestingDSL | |
include AnotherModule | |
extend AnotherModule | |
def hello_from_another_module(obj) | |
say_hello obj | |
end | |
end | |
end | |
t = UserFlowsTest.new | |
t.new_session | |
t.test_user_flow_from_signup_thru_first_trade # => "Hello from AnotherModule #<UserFlowsTest:0x314304>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment