当我跑
rspec .
我得到这样的错误日志:
/Users/max/dev/Circle/lib/active_record.rb:1:in `<top (required)>': uninitialized constant ActiveRecord (NameError)
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/railtie.rb:1:in `require'
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/railtie.rb:1:in `<top (required)>'
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.13/lib/rails/all.rb:12:in `require'
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.13/lib/rails/all.rb:12:in `block in <top (required)>'
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.13/lib/rails/all.rb:5:in `each'
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.13/lib/rails/all.rb:5:in `<top (required)>'
from /Users/max/dev/Circle/config/application.rb:3:in `require'
from /Users/max/dev/Circle/config/application.rb:3:in `<top (required)>'
from /Users/max/dev/Circle/config/environment.rb:2:in `require'
from /Users/max/dev/Circle/config/environment.rb:2:in `<top (required)>'
from /Users/max/dev/Circle/spec/spec_helper.rb:35:in `require'
from /Users/max/dev/Circle/spec/spec_helper.rb:35:in `<top (required)>'
from /Users/max/dev/Circle/spec/controllers/admin/applies_controller_spec.rb:1:in `require'
from /Users/max/dev/Circle/spec/controllers/admin/applies_controller_spec.rb:1:in `<top (required)>'
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
from /Users/max/.rvm/gems/ruby-1.9.3-p374/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'
我已经安装了 gem rspec 和 rspec-rails,但仍然发生错误。谢谢你拯救了我的一天。
编辑1:
Gemfile 是这样的:
source 'http://ruby.taobao.org'
gem "rails", "~> 3.2.9"
gem 'mysql2'
gem 'font-awesome-sass-rails'
gem 'exception_notification'
gem 'bootstrap-editable-rails'
gem 'cancan'
gem 'slim-rails'
gem "jqcloud-rails"
gem 'omniauth'
gem 'omniauth-oauth2'
gem 'acts-as-taggable-on'
gem 'acts_as_commentable', '3.0.1'
gem "acts_as_follower"
gem "select2-rails"
gem 'roadie'
gem 'rails_config'
gem 'daemons'
gem 'rmagick'
gem 'awesome_print'
gem 'mini_magick'
gem 'paperclip', '= 3.1.2'
gem 'cocaine', '= 0.3.2'
gem "will_paginate"
gem "bootstrap-will_paginate"
gem 'twitter-bootstrap-rails', "2.2.0"
gem 'therubyracer', "0.11.1",:platforms => :ruby
gem 'simple_form'
gem 'client_side_validations'
gem 'client_side_validations-simple_form'
gem 'delayed_job_active_record'
gem "responders"
gem 'inherited_resources'
gem 'newrelic_rpm'
gem 'redis'
gem 'redis-objects'
gem 'watir-webdriver'
gem 'nokogiri'
gem 'ruby-pinyin'
gem 'state_machine'
gem 'sitemap_generator'
gem 'ga_measurement', :git => 'https://github.com/nickcen/ga_measurement'
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'libv8'
gem 'therubyracer','0.11.1'
gem 'uglifier'
end
gem 'enumerize'
group :development do
gem "letter_opener"
gem "better_errors"#, :git => 'git://github.com/charliesome/better_errors.git'
gem "binding_of_caller"
gem 'pry-rails'
gem "thin"
end
gem 'jquery-rails'
group :test do
gem 'turn', '~> 0.8.3'
end
group :test, :development do
gem 'rspec-rails'
end
Gemfile.lock 是这样的:
GIT
remote: https://github.com/nickcen/ga_measurement
revision: ecaaabdca410136d75975c3cb6a421e62a7c2d53
specs:
ga_measurement (0.0.1)
rest-client
GEM
remote: http://ruby.taobao.org/
specs:
actionmailer (3.2.13)
actionpack (= 3.2.13)
mail (~> 2.5.3)
actionpack (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
activerecord (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
acts-as-taggable-on (2.4.1)
rails (>= 3, < 5)
acts_as_commentable (3.0.1)
acts_as_follower (0.1.1)
addressable (2.3.4)
ansi (1.4.3)
arel (3.0.2)
awesome_print (1.1.0)
better_errors (0.9.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.1)
debug_inspector (>= 0.0.1)
bootstrap-editable-rails (0.0.5)
railties (>= 3.1)
bootstrap-will_paginate (0.0.9)
will_paginate
builder (3.0.4)
cancan (1.6.10)
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
client_side_validations (3.2.5)
client_side_validations-simple_form (2.1.0)
client_side_validations (~> 3.2.5)
simple_form (~> 2.1.0)
cocaine (0.3.2)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.2)
css_parser (1.3.4)
addressable
daemons (1.1.9)
debug_inspector (0.0.2)
delayed_job (3.0.5)
activesupport (~> 3.0)
delayed_job_active_record (0.4.4)
activerecord (>= 2.1.0, < 4)
delayed_job (~> 3.0)
diff-lcs (1.2.4)
enumerize (0.6.1)
activesupport (>= 3.2)
erubis (2.7.0)
eventmachine (1.0.3)
exception_notification (3.0.1)
actionmailer (>= 3.0.4)
execjs (1.4.0)
multi_json (~> 1.0)
faraday (0.8.7)
multipart-post (~> 1.1)
ffi (1.8.1)
font-awesome-sass-rails (3.0.2.2)
railties (>= 3.1.1)
sass-rails (>= 3.1.1)
has_scope (0.5.1)
hashie (2.0.5)
hike (1.2.3)
httpauth (0.2.0)
i18n (0.6.1)
inherited_resources (1.4.0)
has_scope (~> 0.5.0)
responders (~> 0.9)
journey (1.0.4)
jqcloud-rails (1.0.0)
jquery-rails
jquery-rails (3.0.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.0)
jwt (0.1.8)
multi_json (>= 1.5)
launchy (2.3.0)
addressable (~> 2.3)
letter_opener (1.1.1)
launchy (~> 2.2)
libv8 (3.11.8.17)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.8.1)
mime-types (1.23)
mini_magick (3.6.0)
subexec (~> 0.2.1)
multi_json (1.7.6)
multipart-post (1.2.0)
mysql2 (0.3.11)
newrelic_rpm (3.6.3.106)
nokogiri (1.5.9)
oauth2 (0.8.1)
faraday (~> 0.8)
httpauth (~> 0.1)
jwt (~> 0.1.4)
multi_json (~> 1.0)
rack (~> 1.2)
omniauth (1.1.4)
hashie (>= 1.2, < 3)
rack
omniauth-oauth2 (1.1.1)
oauth2 (~> 0.8.0)
omniauth (~> 1.0)
paperclip (3.1.2)
activemodel (>= 3.0.0)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (>= 0.0.2)
mime-types
polyglot (0.3.3)
pry (0.9.12.2)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
pry-rails (0.3.0)
pry (>= 0.9.10)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.13)
actionmailer (= 3.2.13)
actionpack (= 3.2.13)
activerecord (= 3.2.13)
activeresource (= 3.2.13)
activesupport (= 3.2.13)
bundler (~> 1.0)
railties (= 3.2.13)
rails_config (0.3.3)
activesupport (>= 3.0)
railties (3.2.13)
actionpack (= 3.2.13)
activesupport (= 3.2.13)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.4)
rdoc (3.12.2)
json (~> 1.4)
redis (3.0.4)
redis-objects (0.7.0)
redis (>= 3.0.2)
ref (1.0.5)
responders (0.9.3)
railties (~> 3.1)
rest-client (1.6.7)
mime-types (>= 1.16)
rmagick (2.13.2)
roadie (2.3.4)
actionmailer (> 3.0.0, < 3.3.0)
css_parser
nokogiri (>= 1.4.4)
sprockets
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)
rspec-rails (2.13.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
ruby-pinyin (0.2.1)
rubyzip (0.9.9)
sass (3.2.9)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
select2-rails (3.4.1)
sass-rails
thor (~> 0.14)
selenium-webdriver (2.33.0)
childprocess (>= 0.2.5)
multi_json (~> 1.0)
rubyzip
websocket (~> 1.0.4)
simple_form (2.1.0)
actionpack (~> 3.0)
activemodel (~> 3.0)
sitemap_generator (4.1.0)
builder
slim (2.0.0)
temple (~> 0.6.5)
tilt (~> 1.3, >= 1.3.3)
slim-rails (2.0.1)
actionpack (>= 3.0, < 4.1)
activesupport (>= 3.0, < 4.1)
railties (>= 3.0, < 4.1)
slim (~> 2.0)
slop (3.4.5)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
state_machine (1.2.0)
subexec (0.2.3)
temple (0.6.5)
therubyracer (0.11.1)
libv8 (~> 3.11.8.7)
ref
thin (1.5.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.18.1)
tilt (1.4.1)
treetop (1.4.14)
polyglot
polyglot (>= 0.3.1)
turn (0.8.3)
ansi
twitter-bootstrap-rails (2.2.0)
actionpack (>= 3.1)
execjs
railties (>= 3.1)
tzinfo (0.3.37)
uglifier (2.1.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
watir-webdriver (0.6.4)
selenium-webdriver (>= 2.18.0)
websocket (1.0.7)
will_paginate (3.0.4)
PLATFORMS
ruby
DEPENDENCIES
acts-as-taggable-on
acts_as_commentable (= 3.0.1)
acts_as_follower
awesome_print
better_errors
binding_of_caller
bootstrap-editable-rails
bootstrap-will_paginate
cancan
client_side_validations
client_side_validations-simple_form
cocaine (= 0.3.2)
coffee-rails
daemons
delayed_job_active_record
enumerize
exception_notification
font-awesome-sass-rails
ga_measurement!
inherited_resources
jqcloud-rails
jquery-rails
letter_opener
libv8
mini_magick
mysql2
newrelic_rpm
nokogiri
omniauth
omniauth-oauth2
paperclip (= 3.1.2)
pry-rails
rails (~> 3.2.9)
rails_config
redis
redis-objects
responders
rmagick
roadie
rspec-rails
ruby-pinyin
sass-rails
select2-rails
simple_form
sitemap_generator
slim-rails
state_machine
therubyracer (= 0.11.1)
thin
turn (~> 0.8.3)
twitter-bootstrap-rails (= 2.2.0)
uglifier
watir-webdriver
will_paginate
GIT
remote: https://github.com/nickcen/ga_measurement
revision: ecaaabdca410136d75975c3cb6a421e62a7c2d53
specs:
ga_measurement (0.0.1)
rest-client
GEM
remote: http://ruby.taobao.org/
specs:
actionmailer (3.2.13)
actionpack (= 3.2.13)
mail (~> 2.5.3)
actionpack (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
activerecord (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
acts-as-taggable-on (2.4.1)
rails (>= 3, < 5)
acts_as_commentable (3.0.1)
acts_as_follower (0.1.1)
addressable (2.3.4)
ansi (1.4.3)
arel (3.0.2)
awesome_print (1.1.0)
better_errors (0.9.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.1)
debug_inspector (>= 0.0.1)
bootstrap-editable-rails (0.0.5)
railties (>= 3.1)
bootstrap-will_paginate (0.0.9)
will_paginate
builder (3.0.4)
cancan (1.6.10)
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
client_side_validations (3.2.5)
client_side_validations-simple_form (2.1.0)
client_side_validations (~> 3.2.5)
simple_form (~> 2.1.0)
cocaine (0.3.2)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.2)
css_parser (1.3.4)
addressable
daemons (1.1.9)
debug_inspector (0.0.2)
delayed_job (3.0.5)
activesupport (~> 3.0)
delayed_job_active_record (0.4.4)
activerecord (>= 2.1.0, < 4)
delayed_job (~> 3.0)
diff-lcs (1.2.4)
enumerize (0.6.1)
activesupport (>= 3.2)
erubis (2.7.0)
eventmachine (1.0.3)
exception_notification (3.0.1)
actionmailer (>= 3.0.4)
execjs (1.4.0)
multi_json (~> 1.0)
faraday (0.8.7)
multipart-post (~> 1.1)
ffi (1.8.1)
font-awesome-sass-rails (3.0.2.2)
railties (>= 3.1.1)
sass-rails (>= 3.1.1)
has_scope (0.5.1)
hashie (2.0.5)
hike (1.2.3)
httpauth (0.2.0)
i18n (0.6.1)
inherited_resources (1.4.0)
has_scope (~> 0.5.0)
responders (~> 0.9)
journey (1.0.4)
jqcloud-rails (1.0.0)
jquery-rails
jquery-rails (3.0.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.0)
jwt (0.1.8)
multi_json (>= 1.5)
launchy (2.3.0)
addressable (~> 2.3)
letter_opener (1.1.1)
launchy (~> 2.2)
libv8 (3.11.8.17)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.8.1)
mime-types (1.23)
mini_magick (3.6.0)
subexec (~> 0.2.1)
multi_json (1.7.6)
multipart-post (1.2.0)
mysql2 (0.3.11)
newrelic_rpm (3.6.3.106)
nokogiri (1.5.9)
oauth2 (0.8.1)
faraday (~> 0.8)
httpauth (~> 0.1)
jwt (~> 0.1.4)
multi_json (~> 1.0)
rack (~> 1.2)
omniauth (1.1.4)
hashie (>= 1.2, < 3)
rack
omniauth-oauth2 (1.1.1)
oauth2 (~> 0.8.0)
omniauth (~> 1.0)
paperclip (3.1.2)
activemodel (>= 3.0.0)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (>= 0.0.2)
mime-types
polyglot (0.3.3)
pry (0.9.12.2)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
pry-rails (0.3.0)
pry (>= 0.9.10)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.13)
actionmailer (= 3.2.13)
actionpack (= 3.2.13)
activerecord (= 3.2.13)
activeresource (= 3.2.13)
activesupport (= 3.2.13)
bundler (~> 1.0)
railties (= 3.2.13)
rails_config (0.3.3)
activesupport (>= 3.0)
railties (3.2.13)
actionpack (= 3.2.13)
activesupport (= 3.2.13)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.4)
rdoc (3.12.2)
json (~> 1.4)
redis (3.0.4)
redis-objects (0.7.0)
redis (>= 3.0.2)
ref (1.0.5)
responders (0.9.3)
railties (~> 3.1)
rest-client (1.6.7)
mime-types (>= 1.16)
rmagick (2.13.2)
roadie (2.3.4)
actionmailer (> 3.0.0, < 3.3.0)
css_parser
nokogiri (>= 1.4.4)
sprockets
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)
rspec-rails (2.13.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
ruby-pinyin (0.2.1)
rubyzip (0.9.9)
sass (3.2.9)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
select2-rails (3.4.1)
sass-rails
thor (~> 0.14)
selenium-webdriver (2.33.0)
childprocess (>= 0.2.5)
multi_json (~> 1.0)
rubyzip
websocket (~> 1.0.4)
simple_form (2.1.0)
actionpack (~> 3.0)
activemodel (~> 3.0)
sitemap_generator (4.1.0)
builder
slim (2.0.0)
temple (~> 0.6.5)
tilt (~> 1.3, >= 1.3.3)
slim-rails (2.0.1)
actionpack (>= 3.0, < 4.1)
activesupport (>= 3.0, < 4.1)
railties (>= 3.0, < 4.1)
slim (~> 2.0)
slop (3.4.5)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
state_machine (1.2.0)
subexec (0.2.3)
temple (0.6.5)
therubyracer (0.11.1)
libv8 (~> 3.11.8.7)
ref
thin (1.5.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.18.1)
tilt (1.4.1)
treetop (1.4.14)
polyglot
polyglot (>= 0.3.1)
turn (0.8.3)
ansi
twitter-bootstrap-rails (2.2.0)
actionpack (>= 3.1)
execjs
railties (>= 3.1)
tzinfo (0.3.37)
uglifier (2.1.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
watir-webdriver (0.6.4)
selenium-webdriver (>= 2.18.0)
websocket (1.0.7)
will_paginate (3.0.4)
PLATFORMS
ruby
DEPENDENCIES
acts-as-taggable-on
acts_as_commentable (= 3.0.1)
acts_as_follower
awesome_print
better_errors
binding_of_caller
bootstrap-editable-rails
bootstrap-will_paginate
cancan
client_side_validations
client_side_validations-simple_form
cocaine (= 0.3.2)
coffee-rails
daemons
delayed_job_active_record
enumerize
exception_notification
font-awesome-sass-rails
ga_measurement!
inherited_resources
jqcloud-rails
jquery-rails
letter_opener
libv8
mini_magick
mysql2
newrelic_rpm
nokogiri
omniauth
omniauth-oauth2
paperclip (= 3.1.2)
pry-rails
rails (~> 3.2.9)
rails_config
redis
redis-objects
responders
rmagick
roadie
rspec-rails
ruby-pinyin
sass-rails
select2-rails
simple_form
sitemap_generator
slim-rails
state_machine
therubyracer (= 0.11.1)
thin
turn (~> 0.8.3)
twitter-bootstrap-rails (= 2.2.0)
uglifier
watir-webdriver
will_paginate