jlindley (owner)

Revisions

  • f69ea5 jlindley Fri Nov 14 07:07:18 -0800 2008
  • f1dcbb jlindley Tue Nov 04 08:02:25 -0800 2008
  • b5558d jlindley Tue Nov 04 08:01:51 -0800 2008
  • 376b5f jlindley Tue Nov 04 07:14:06 -0800 2008
gist: 22144 Download_button fork
public
Description:
Relating to this rspec ticket: http://rspec.lighthouseapp.com/projects/5645/tickets/589
Public Clone URL: git://gist.github.com/22144.git
Embed All Files: show embed
rspec-NoMethodError.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 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