0

这是我在尝试执行 bundle exec rspec spec/requests/static_pages_spec.rb 时遇到的错误:

No DRb server is running. Running in local process instead ...
/Users/hetzerbr/sample_app/spec/requests/static_pages_spec.rb:1:in `require': /Users/hetzerbr/sample_app/spec/spec_helper.rb:29: syntax error, unexpected tASSOC, expecting kEND (SyntaxError)
    config.fixture_path => "#{::Rails.root}/spec/fixtures"
                          ^
    from /Users/hetzerbr/sample_app/spec/requests/static_pages_spec.rb:1
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:66:in `run'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `autorun'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/bin/ruby_noexec_wrapper:14

我正在使用带有 brew install 和 RVM 以及 ruby​​ 1.8.7 的 Mac Osx10.8。我在 ruby​​ on rails 教程的第五章中间,由下面的评论修复,但是现在我收到了这个错误:

rvm/gems/ruby-1.8.7-p374/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:177:in `require': no such file to load -- iconv (LoadError)
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:177
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/execjs-1.4.0/lib/execjs/runtimes.rb:3:in `require'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/execjs-1.4.0/lib/execjs/runtimes.rb:3
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/execjs-1.4.0/lib/execjs.rb:2:in `require'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/execjs-1.4.0/lib/execjs.rb:2
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/coffee-script-2.2.0/lib/coffee_script.rb:1
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/coffee-script-2.2.0/lib/coffee-script.rb:1
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `require'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /Users/hetzerbr/sample_app/config/application.rb:13
    from /Users/hetzerbr/sample_app/config/environment.rb:2:in `require'
    from /Users/hetzerbr/sample_app/config/environment.rb:2
    from /Users/hetzerbr/sample_app/spec/spec_helper.rb:10:in `require'
    from /Users/hetzerbr/sample_app/spec/spec_helper.rb:10
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/spork-0.9.0/lib/spork.rb:24:in `prefork'
    from /Users/hetzerbr/sample_app/spec/spec_helper.rb:4
    from /Users/hetzerbr/sample_app/spec/requests/static_pages_spec.rb:1:in `require'
    from /Users/hetzerbr/sample_app/spec/requests/static_pages_spec.rb:1
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:66:in `run'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `autorun'
    from /Users/hetzerbr/.rvm/gems/ruby-1.8.7-p374/bin/ruby_noexec_wrapper:14
4

1 回答 1

1

问题是您使用火箭符号来分配值,您应该使用=(等号)符号。在 youspec/spec_helper.rb中,找到该行config.fixture_path并修改如下:

config.fixture_path = "#{::Rails.root}/spec/fixtures"

并尝试再次运行您的测试。

于 2013-07-25T13:32:39.683 回答