我正在为Ruby on Rails应用程序中的模型编写Rspec测试.我在启动'rspec spec'时收到此错误
command:
/spec/models/client_spec.rb:4:in `<top (required)>': uninitialized constant Client (NameError)
Run Code Online (Sandbox Code Playgroud)
我使用Rails 4.0.0和Ruby 2.0.0
这是我的client_spec.rb:
require 'spec_helper'
describe Client do
it 'is invalid without first_name', :focus => true do
client = Client.new
client.should_not be_valid
end
end
Run Code Online (Sandbox Code Playgroud)
和Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0.rc1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0.rc1'
# Use Uglifier as compressor for JavaScript assets …Run Code Online (Sandbox Code Playgroud)