简体   繁体   中英

Sass is breaking Rspec (uninitialized constant Sass::Util (NameError))

When I try to run rspec or autotest I keep getting the error:

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

After I remove sass from my Gemfile the specs run fine.

Is there a way to tell rspec to ignore a gem? Or what do I have to do get rspec/autotest to run? And why does rspec depend on the Gemfile to run anyways? rake spec works fine, but running rspec /file/path or autotest doesn't.

My gemfile looks like this:

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

Here's what spits out when I run gem list

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)

Not sure if this was related, but this post came up top when googling for that error message.

I was getting the following exception after upgrading to 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

which was caused because I had an old compass.rb file in config/initializer.

Deleting that file solved my problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM