0

每当我尝试输入命令时:

bundle exec rspec spec/requests/static_pages_spec.rb

它出现了以下错误消息:

/var/lib/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load': /home/nathan/Rails_Projects/sample_app/spec/requests/static_pages_spec.rb:40: syntax error, unexpected kEND, expecting $end (SyntaxError)
    from /var/lib/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
    from /var/lib/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
    from /var/lib/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
    from /var/lib/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
    from /var/lib/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
    from /var/lib/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `autorun'
    from /usr/local/bin/rspec:19
4

1 回答 1

0

您的测试文件s 中static_pages_spec.rb包含太多ends,或者之前的错误意味着它缺少有效end.

解析器遇到的是kEND(即“关键字结尾”)而不是$end(即文件结尾)。

编辑:看起来您缺少do粘贴的第 12 行(并且第 7-14 行的缩进不正常)。

于 2012-08-22T09:09:16.830 回答