Report abuse

categories_controller_spec.rb

1
2
3
4
5
6
7
8
9
10
11
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe User::CategoriesController do
  describe "GET index" do
    it ": controller.current_user should be called" do
      controller.should_receive(:current_user)
      get :index
    end
  end
end

categories_controller.rb

1
2
3
4
5
class User::CategoriesController < UserController
  def index
    current_user
  end
end

rake spec:controllers output

1
2
3
4
5
6
7
8
9
10
11
usr/bin/ruby1.8 /usr/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec --autospec spec/controllers/user/categories_controller_spec.rb -O spec/spec.opts
F

1)
Spec::Mocks::MockExpectationError in 'User::CategoriesController GET index : controller.current_user should be called'
#<User::CategoriesController:0xb7439484> expected :current_user with (any args) once, but received it 0 times


Finished in 0.064369 seconds

1 example, 1 failure