2012-07-23 105 views
0

我是新手上红宝石在铁轨上和我试图测试我的控制器在红宝石在轨道上。 它的工作,但现在我不知道发生了什么,但是当我做了测试,我得到了一个错误信息:`负载':没有这样的文件加载

/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) 

这是我的spec文件:

require 'spec_helper' 

describe UserController do 

it "create new user" do 
    get :create, :user => { :email => '[email protected]', :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: "[email protected]" 
    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 

和这是我的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 
+0

与您的问题没有直接关系,但使用Rails控制器的单个名称可能会出现问题。按照惯例,这应该被称为'UsersController',文件名应该是users_controller.rb。 – 2012-07-24 07:42:17

回答

0
/Users/armandodejesussantoyareales/Documents/project_newbie/Estaciones/estaciones/spec/controllers/user_controller_spec.rb 

你确定这是正确的道路?在终端,什么时候你就输入情况:

ls /Users/armandodejesussantoyareales/Documents/project_newbie/Estaciones/estaciones/spec/controllers/user_controller_spec.rb 

如果你得到一个错误说No such file or directory,那么此路径不存在。如果它只是回响道路,那就很好。

或者,您可以手动查找此文件并验证路径。但无论哪种方式,我的猜测是你只是错误地输入了你的spec文件的路径。

+0

好的非常感谢 – Asantoya17 2012-07-23 15:12:20

+0

不客气! – MrDanA 2012-07-23 15:21:21

相关问题