【发布时间】:2015-01-24 18:06:56
【问题描述】:
我正在尝试阅读本教程,但我感觉这与 rspec 有关。目标是使每个测试通过。这是我可以做教程的网站,但我更喜欢在我自己的 mac book 上做。
https://web.archive.org/web/20140328135623/http://testfirst.org/learn_ruby
我是第一个,每次我都跑
$ruby hello_spec.rb
我收到此错误。
hello_spec.rb:118:in `<main>': undefined method `describe' for main:Object (NoMethodError)
rspec (3.1.0, 2.99.0, 2.14.1)
ruby 2.0.0p481(2014-05-08 修订版 45883)[x86_64-darwin14.0.0]
require_relative "hello"
describe "the hello function" do
it "says hello" do
hello.should == "Hello!"
end
end
describe "the greet function" do
it "says hello to someone" do
greet("Alice").should == "Hello, Alice!"
end
it "says hello to someone else" do
greet("Bob").should == "Hello, Bob!"
end
end
请帮忙!
【问题讨论】:
-
您需要向我们展示您正在运行的代码。您是否安装了
rspec并且在该文件中需要它?默认不安装 -
请给代码...
标签: ruby-on-rails ruby rspec