gems/ruby-1.9.2-head/bundler/gems/rspec-
core-2398fcadf5beb256bed9c548c59445d3b4c8a047-master/lib/rspec/core/
backward_compatibility.rb:26:in const_missing': uninitialized constant Message::User (NameError) from /Users/kristianconsult/.rvm/gems/ruby-1.9.2-head/bundler/gems/ rspec-expectations-996c752171a0a0e16347e934dadc25767e31186c-master/lib/ rspec/expectations/backward_compatibility.rb:6:in
const_missing’
from /Users/kristianconsult/Development/Languages/Ruby/Apps/Web-apps/
Rails/Rails-3/Experimental/views_example/app/models/message.rb:2:in
<class:Message>' from /Users/kristianconsult/Development/Languages/Ruby/Apps/Web-apps/ Rails/Rails-3/Experimental/views_example/app/models/message.rb:1:in
<top (required)>’
class Message < ActiveRecord::Base
belongs_to :recipient, :class_name => User.name
validates_presence_of :title, :text, :recipient
end
require ‘spec_helper’
class User
end
describe Message do
before(:each) do
@message = Message.new(
:title => “foo”,
:text => “bar”,
:recipient => mock_model(User)
)
end
…
If I uncomment the :class_name option on the belongs_to relation of
Message:
Failure/Error: @message = Message.new(
uninitialized constant Message::Recipient
Hmm??