[rspec-users] mock_model not working in rspec2?

David Chelimsky dchelimsky at gmail.com
Thu Jun 10 00:49:48 EDT 2010


Please report this to http://github.com/rspec/rspec-rails/issues

On Thu, Jun 10, 2010 at 12:08 AM, Kristian Mandrup <kmandrup at gmail.com> wrote:
> undefined method `model_name' for Message:Class
> ---
>
> # spec/views/messages/new.html.erb_spec.rb
>
> class Message; end
>
>  describe "messages/new.html.erb" do
>    it "renders a form to create a message" do
>      assign(:message, mock_model(Message).as_new_record)
>      render
>
>
> # app/views/messages/new.html.erb
>  <%= form_for @message do |f| %>
>    <%= f.submit "Save" %>
>  <% end %>
> ---
>
> 1) messages/new.html.erb renders a form to create a message
>    Failure/Error: Unable to find matching line from backtrace
>    undefined method `model_name' for Message:Class
>    # On line #1 of /users/kristianconsult/development/languages/ruby/
> apps/web-apps/rails/rails-3/experimental/views_example/app/views/
> messages/new.html.erb
>
>    1: <%= form_for @message do |f| %>
>    2:   <%= f.submit "Save" %>
>    3: <% end %>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list