Search code examples
ruby-on-railspassengerrspec-railsvagrant

Rspec tests passing without actions being implemented


Hi there am working on a rails project, using a vagrant box(with ubuntu server fully configured with passenger, trying a hand at developing on a production like environment because this is my target production environment).

My problem though is that when i run "rails g controller people" and i write a simple controller spec like;

require 'spec_helper'

describe PeopleController do
  describe "GET #index" do
    it "responds with success" do
      get :index
      expect(response).to be_success
    end
  end
end

and i run it with "rspec spec/controllers/", the test passes right away even without having created an index action in the controller.

What do you think could be causing this? Thank you


Solution

  • Is there an index.html.erb in app/views/people? If so Rails implicitly creates an action for you that renders the template.