2012-07-23 60 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

相關問題