lib 디렉토리/RSpec에/코어/my_methods.rbRuby rspec에서 모듈을 호출하는 방법은 무엇입니까?
module MyLovelyModule
class My_methods
def my_lovely_method
save_world
config.to_prepare do
Dir.glob(Rails.root + "../simpleRspec/dummy_classes.rb").each do |c|
require_dependency(c)
end
end
end
end
end
lib 디렉토리/simpleRspec/dummy_classes.rb
describe MyLovelyModule do
class DummyClasses
before(:all) do
@dummy = DummyClasses.new
@dummy.extend MyLovelyModule
end
describe "MyLovelyModule" do
it "saves the world" do
expect {
@dummy.my_lovely_method
}.to raise_error MeltDownException
end
end
end
end
은 그 같은 오류가 발생했습니다 : -
C:/Users/afzala/RubymineProjects/simpleRspec/lib/simpleRspec/dummy_classes.rb:2:in `<top (required)>': uninitialized constant MyLovelyModule (NameError)
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
수 누군가하시기 바랍니다 이 문제에 대해 도움을 청하십시오.
spec_helper.rb 파일이 있습니까? 너도 그걸 보여 줄 수 있니? 레일 앱인가요? – BroiSatse