Created
November 4, 2008 15:14
-
-
Save jlindley/22144 to your computer and use it in GitHub Desktop.
Relating to this rspec ticket: http://rspec.lighthouseapp.com/projects/5645/tickets/589
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
# RSpec ticket: http://rspec.lighthouseapp.com/projects/5645/tickets/589 | |
# see output and version string below... | |
require 'rubygems' | |
require 'spec' | |
class ApplicationModel | |
def self.address_attribute(address) | |
define_method "#{address}_attribute=" do |attributes| | |
load_address(address, attributes) | |
end | |
end | |
end | |
describe ApplicationModel do | |
describe "self.address_attribute" do | |
it "should work with multiple parameters" do | |
ApplicationModel.should_receive(:define_method).with("bork_attribute=") | |
ApplicationModel.address_attribute :bork | |
end | |
it "should define a new method" do | |
ApplicationModel.address_attribute :bork | |
end | |
end | |
end | |
# jlindley@Hypatia:~$ spec -v | |
# rspec 1.1.11 | |
# | |
# jlindley@Hypatia:~/sites/cpi2/spec/models(master)$ spec application_model_spec.rb | |
# .F | |
# | |
# 1) | |
# NoMethodError in 'ApplicationModel self.address_attribute should define a new method' | |
# undefined method `define_method' for ApplicationModel:Class | |
# ./application_model_spec.rb:8:in `address_attribute' | |
# ./application_model_spec.rb:22: | |
# | |
# Finished in 0.007871 seconds | |
# | |
# 2 examples, 1 failure | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment