Rspec not hitting controller method/ Controller method not found in Rspec


Rspec not hitting controller method/ Controller method not found
in Rspec


I have a controller called as Account -> login(method) and 
in spec account_controller_spec.rb
require 'spec_helper'
describe AccountController, :type => :controller do
it "login" do
get :login
response.should be_successful
end
end 
but its not hitting the controller method. test is passing may i know the reason?

My Purposed solution on LinkedIn


1. 
change get :login 

with 

get 'accounts/login' 

OR use rails route helper in for this 

2. also if it did not get routes_helpers then include this line in your 
spec_helper.rb 

config.include Rails.application.routes.url_helpers 

3. one more thing 
in your project directory in terminal/console/cmd 

run this command 

tail -f log/test.log 

AND Then run this test again. 

You can see the work flow behind the sceen.
Advertisements

I am Senior Software Engineer. I love reading, writing, sharing,developing, hiking, movies, trips, mountains, brooks, hills etc.

Tagged with: ,
Posted in Integration testing, RSpec and Cucumber

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

StackOverFlow
Categories
Archives
%d bloggers like this: