Terminal と Sublime Text 3 を使用して非常に基本的なテストを実行しようとしています。単純なテストは実行されますが、失敗します ( undefined local variable or method 'x'
)
私のフォルダ階層は次のようになります。
spec_helper.rb は次のようになります。
require_relative '../test'
require 'yaml'
test_spec.rb は非常に基本的なものです
require 'spec_helper.rb'
describe "testing ruby play" do
it "finds if x is equal to 5" do
x.should eql 5
end
end
私のtest.rbファイルにはx = 5
それだけです。
変数は、クラスの一部である場合にのみ認識されますか? また、テストを実行するたびに新しいクラスを呼び出す必要がありますか?