0
RSpec을 사용하여 단위 테스트를 만들었습니다.루비 RSpec 단위 테스트에서 정의되지 않은 메서드 오류가 발생합니다.
app.rb가 있습니다
module AppModule
class App
def get_item
str = self.get_string
puts "in get_item - #{str}"
end
def get_string
puts "hello, world"
end
end
end
app_test.rb가 있습니다
require 'test_helper'
require 'env'
describe App do
before :each do
@var = App.new
end
describe "firsttest" do
it "should print string" do
@var.get_item
end
end
end
은 내가 찾으십시오 get_item가 제대로 호출이다. #App에 대한
정의되지 않은 방법에서는 get_string : 0x2eaqc4600
감사가에서는 get_string을 얻을 때, 나는 오류가 발생합니다.
(관련이 없지만'str = get_string'을 알았 더라면 효과가 있더라도'str'을'nil'으로 설정하겠습니까?) –