Created
September 26, 2011 18:23
-
-
Save nwjsmith/1242954 to your computer and use it in GitHub Desktop.
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
require 'rspec' | |
module Evil | |
def defn(method_name) | |
class_eval <<-METHOD, __FILE__, __LINE__ + 1 | |
def #{method_name} | |
end | |
METHOD | |
end | |
end | |
class Bob | |
extend Evil | |
defn :foo | |
end | |
class Alice | |
extend Evil | |
defn :bar | |
end | |
describe Alice do | |
it { should respond_to :bar } | |
it { should_not respond_to :foo } | |
end | |
describe Bob do | |
it { should respond_to :foo } | |
it { should_not respond_to :bar } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment