2011-03-26 55 views
0

当我尝试rspec的运行或自动测试我不断收到错误:萨斯是打破Rspec的(未初始化不断萨斯::的Util(NameError))

/Users/Craig/.rvm/gems/ruby-1.9.2-p136/gems/sass-3.1.0.alpha.249/lib/sass/plugin.rb:35:in `<module:Plugin>': uninitialized constant Sass::Util (NameError) 

后,我从我的Gemfile删除青菜的规格运行良好。

有没有办法告诉rspec忽略宝石?或者我必须做些什么才能使rspec/autotest运行?为什么rspec依赖于Gemfile来运行呢?耙规格工作正常,但运行rspec /文件/路径或自动测试不。

我的Gemfile看起来是这样的:

source "http://rubygems.org" 

gem "rails", "3.0.5" 

gem "grape" 

gem "mongoid", "2.0.0.rc.7" 
gem "bson_ext", "1.2.4" 
gem "mongoid_search" 
gem "will_paginate", :git => "https://github.com/mislav/will_paginate.git", :branch => "rails3" 
gem "bluecloth", "2.0.0" 

gem "devise", :git => "https://github.com/plataformatec/devise.git" 
gem "oauth2" 
gem "warden_oauth" 
gem "devise_invitable", :git => "https://github.com/scambra/devise_invitable.git" 

gem "simple_form", :git => "https://github.com/plataformatec/simple_form.git" 
gem "haml", :git => "https://github.com/nex3/haml.git" 
gem "compass", ">= 0.10.6" 
gem "sass" 
gem "fog" 
gem "rmagick" 
gem "carrierwave", :git => "https://github.com/jnicklas/carrierwave.git" 
gem "jquery-rails" 
gem "quasi", "0.1.0", :path => "./vendor/gems/quasi-0.1.0/" 
gem "mongoid_slug", :require => "mongoid/slug", :git => "https://github.com/papercavalier/mongoid-slug.git" 
gem "faker" 
gem "jammit", :git => "https://github.com/caifara/jammit.git" 
gem "sanitize" 
gem "right_aws", :git => "https://github.com/rightscale/right_aws.git" 

group :development do 
    gem "yard", "0.6.4" 
    gem "yard-dm", "0.1.1" 
    gem "hpricot" 
    gem "ruby_parser" 
    gem "ruby-debug19" 
    gem "rails3-generators", :git => "https://github.com/indirect/rails3-generators.git" 
    gem "haml-rails",   :git => "https://github.com/indirect/haml-rails.git" 
    gem "hirb" 
    gem "heroku_san", "1.0.8" 
    gem "right_http_connection", :git => "https://github.com/rightscale/right_http_connection.git" 
    gem "barista", :platforms => :ruby 
    gem "therubyracer", :platforms => :ruby 
end 

group :development, :test do 
    gem "rspec-rails",   :git => "https://github.com/rspec/rspec-rails.git" 
    gem "whenever", :require => false 
    gem "pathy" 
end 

group :test do 
    gem "nokogiri" , "~> 1.4.4.0" 
    gem "jasmine" 
    gem "rspec",    :git => "https://github.com/rspec/rspec.git" 
    gem "rspec-core",   :git => "https://github.com/rspec/rspec-core.git" 
    gem "rspec-expectations", :git => "https://github.com/rspec/rspec-expectations.git" 
    gem "rspec-mocks",   :git => "https://github.com/rspec/rspec-mocks.git" 
    gem "spork", "~> 0.9.0.rc", :git => "https://github.com/timcharper/spork.git" 
    gem "steak", ">=1.0",  :git => "https://github.com/cavalle/steak.git" 
    gem "capybara",    :git => "https://github.com/jnicklas/capybara.git" 
    gem "fabrication",   :git => "https://github.com/paulelliott/fabrication.git" 
end 

group :production do 
    gem "dalli" 
end 

这里是吐出来的时候我跑的宝石列表

aaronh-chronic (0.3.9) 
abstract (1.0.0) 
actionmailer (3.0.5) 
actionpack (3.0.5) 
activemodel (3.0.5) 
activerecord (3.0.5) 
activeresource (3.0.5) 
activesupport (3.0.5) 
addressable (2.2.4) 
algorithms (0.3.0) 
archive-tar-minitar (0.5.2) 
arel (2.0.9) 
autotest (4.4.6) 
autotest-fsevent (0.2.5) 
autotest-growl (0.2.9) 
barista (1.0.0) 
bcrypt-ruby (2.1.4) 
bluecloth (2.0.0) 
bson (1.2.4) 
bson_ext (1.2.4) 
builder (2.1.2) 
bundler (1.0.10) 
capybara (0.4.1.2) 
celerity (0.8.8) 
childprocess (0.1.7) 
chunky_png (1.1.0) 
closure-compiler (1.0.0) 
coffee-script (2.1.3) 
coffee-script-source (1.0.1) 
columnize (0.3.2) 
compass (0.10.6) 
configuration (1.2.0) 
culerity (0.2.15) 
dalli (1.0.2) 
diff-lcs (1.1.2) 
erubis (2.6.6) 
excon (0.5.6) 
faker (0.9.5) 
faraday (0.5.7) 
ffi (0.6.3) 
fog (0.6.0) 
formatador (0.0.16) 
grape (0.1.3) 
haml (3.0.25) 
heroku (1.18.0) 
heroku_san (1.0.8) 
hirb (0.4.0) 
hpricot (0.8.4) 
i18n (0.5.0) 
iobuffer (1.0.0) 
jasmine (1.0.1.1) 
jquery-rails (0.2.7) 
json (1.5.1) 
json_pure (1.5.1) 
launchy (0.3.7) 
linecache19 (0.5.11) 
mail (2.2.15) 
mime-types (1.16) 
mongo (1.2.4) 
mongoid (2.0.0.rc.7) 
mongoid_search (0.1.2) 
multi_json (0.0.5) 
multi_xml (0.2.1) 
multipart-post (1.1.0) 
net-ssh (2.1.0) 
nokogiri (1.4.4) 
oauth (0.4.4) 
oauth2 (0.1.1) 
orm_adapter (0.0.4) 
pathy (0.0.4) 
polyglot (0.3.1) 
rack (1.2.1) 
rack-jsonp (1.1.0) 
rack-mount (0.6.13) 
rack-test (0.5.7) 
rails (3.0.5) 
railties (3.0.5) 
rake (0.8.7) 
rest-client (1.6.1) 
rev (0.3.2) 
rmagick (2.13.1) 
rspec (2.5.0) 
rspec-core (2.5.1) 
rspec-expectations (2.5.0) 
rspec-mocks (2.5.0) 
rspec-rails (2.5.0) 
ruby-debug-base19 (0.11.24) 
ruby-debug19 (0.11.6) 
ruby-fsevent (0.2.1) 
ruby-hmac (0.4.0) 
ruby_core_source (0.1.4) 
ruby_parser (2.0.6) 
rubystats (0.2.3) 
rubyzip (0.9.4) 
sanitize (2.0.0) 
sass (3.1.0.alpha.249, 3.1.0.alpha.221) 
selenium-client (1.2.18) 
selenium-rc (2.3.1) 
selenium-webdriver (0.1.3) 
sexp_processor (3.0.5) 
spork (0.8.4) 
stackdeck (0.2.0) 
stringex (1.2.0) 
sys-uname (0.8.5) 
therubyracer (0.8.1) 
thor (0.14.6) 
treetop (1.4.9) 
tzinfo (0.3.24) 
warden (1.0.3) 
warden_oauth (0.1.1) 
watchr (0.7) 
whenever (0.6.6) 
xpath (0.1.3) 
yard (0.6.4) 
yard-dm (0.1.1) 
yui-compressor (0.9.4) 
ZenTest (4.5.0) 
+1

rspec不依赖于Gemfile,但rspec-rails的确如此。它加载Rails环境,它使用bundler来要求正确版本化的gem,因此Gemfile。如果您在规格上遇到Sass问题,那么它可能会在其他地方出现。似乎是找出问题根源的好时机。 – 2011-03-26 23:29:32

+0

你可以发布你的gemfile吗? – Shiv 2011-03-26 23:38:39

+0

嗯,谢谢,我添加了编辑我的原始文章与我的gemfile。 – Craig 2011-03-27 01:17:55

回答

1

不知道这是否是相关的,但是google搜索,当这个职位上来顶错误信息。

我正在升级到Rails 3.1后,以下情况除外:

/Library/Ruby/Gems/1.8/gems/sass-3.1.12/lib/sass/../sass/plugin/compiler.rb:29: uninitialized constant Sass::Util (NameError) 
    from /Library/Ruby/Gems/1.8/gems/sass-3.1.12/lib/sass/../sass/plugin.rb:4 
    from /Library/Ruby/Gems/1.8/gems/haml-3.1.4/lib/sass/rails3_shim.rb:15 
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval' 
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' 
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:26:in `on_load' 
    from /Library/Ruby/Gems/1.8/gems/haml-3.1.4/lib/sass/rails3_shim.rb:13 
    from /Library/Ruby/Gems/1.8/gems/sass-3.1.12/lib/sass/../sass.rb:19 
    from /Library/Ruby/Gems/1.8/gems/sass-3.1.12/lib/sass/version.rb:3 
    from /Library/Ruby/Gems/1.8/gems/haml-3.1.4/lib/haml/util.rb:347:in `try_sass' 
    from /Library/Ruby/Gems/1.8/gems/haml-3.1.4/lib/sass.rb:6 

这是因为我在配置/初始化一个老compass.rb文件引起的。

删除该文件解决了我的问题