bundle exec rspec spec / requests / static_pages_spec.rb语法错误

时间:2012-06-02 20:44:24

标签: rspec

(使用Hartl的教程) 我使用rspec进行测试时没有遇到任何问题,但是在完成了部分,合并分支等之后 - 我再也无法运行rspec测试了。我正在第4章尝试进行第一组测试但是我得到了以下错误:

  

C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec   /core/configuration.rb:746:in load': C:/Sites/rails_projects/sample_app/spec/re quests/static_pages_spec.rb:61: syntax error, unexpected $end, expecting keyword _end (SyntaxError) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 0.1/lib/rspec/core/configuration.rb:746:in块中的load_spec_files'           来自C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1   0.1 / lib / rspec / core / configuration.rb:746:在map' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 0.1/lib/rspec/core/configuration.rb:746:in load_spec_files'中           来自C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1   0.1 / lib / rspec / core / command_line.rb:22:in run' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 0.1/lib/rspec/core/runner.rb:69:in run'           来自C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1   0.1 / lib / rspec / core / runner.rb:10:在`block in autorun'

可能是什么问题?我尝试运行rails generate rspec:install并再试一次,但没有运气。

1 个答案:

答案 0 :(得分:0)

首先在static_pages_spec.rb文件中存在语法错误...您需要修复...您应该检查Hartl的代码以获得正确的语法...

第二,确保从应用程序的根目录运行rspec ...在Hartl的教程中可能称为sample_app ...

如果这些都不起作用,那么你应该从C:/ ...

开始给出rpsec和绝对路径

让我知道它是否有效..