I’m newbie on ruby on rails and I’m trying to test my controller with respect on ruby on rails.
It worked before, but now I don’t know what happened, but when I do the test, I got the next error message:
/Library/Ruby/Gems/1.8/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `load': no such file to load -- /Users/armandodejesussantoyareales/Documents/project_newbie/Estaciones/estaciones/spec/controllers/user_controller_spec.rb (LoadError)
this is my spec file:
require 'spec_helper'
describe UserController do
it "create new user" do
get :create, :user => { :email => 'foo@example.com', :name => 'userexample' }
flash[:notice] = 'new user was successfully created.'
end
describe "signup" do
before { visit signup_path }
let(:submit) { "Create my account" }
describe "with invalid information" do
it "should not create a user" do
expect { click_button submit }.not_to change(User, :count)
end
end
describe "with valid information" do
before do
fill_in "Name", with: "Example User"
fill_in "Email", with: "user@example.com"
fill_in "Password", with: "foobar"
fill_in "Confirmation", with: "foobar"
end
it "should create a user" do
expect { click_button submit }.to change(User, :count).by(1)
end
end
end
end
and this is my Usercontroller
class UserController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(params[:user])
if @user.save
redirect_to user_session_path
else
redirect_to new_user_session_path
end
def show
@user = User.find(params[:id])
#redirect_to @user
end
end
Are you sure that’s the right path? In a terminal, what happens when you do type in:
If you get an error saying
No such file or directory, then that path doesn’t exist. If it just echoes back the path, then it’s fine.Alternatively, you can just manually look for this file and verify the path. But either way, my guess is you are just entering the path to your spec file incorrectly.