Ruby on RailsのRSpecを実行しようとしている。私はRails 5.0を実行しています。宝石をインストールし、いくつかのテストでスペックフォルダを作成しました。rspecを実行しようとするとエラーが発生するエラー/エラー:require 'test' LoadError:そのようなファイルを読み込めない - テスト
は、私が 'test.rb' というファイルを作成し、コンソール
$ rspec --init
create spec/spec_helper.rb
create .rspec
で次のコマンドを実行します。
class Test
end
私は 'zombie_spec.rb' というファイルを作成します。
require 'spec_helper'
require 'test'
describe Test do
it " Name Is Bapu." do
# test = test.new
# test.name.should == 'bapu'
end
end
その後、私は、このコマンドを実行した後。
rspec spec/lib/zombie_spec.rb
それはエラー⬇
An error occurred while loading ./spec/lib/zombie_spec.rb.
Failure/Error: require 'test'
LoadError:
cannot load such file -- test
# ./spec/lib/zombie_spec.rb:2:in `require'
# ./spec/lib/zombie_spec.rb:2:in `<top (required)>'
No examples found.
Finished in 0.00026 seconds (files took 0.40148 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples
私はテストの実行を開始できるように、どのように私はこの問題を解決するかを示して?
'test'ではなく' zombie'が必要です。あなたのファイルは 'test.rb'ではなく' zombie.rb'と呼ばれています –
私は自分の間違いを犯してしまいます。私はtest.rbを作成します –