난 그냥 루비 테스트 작업을 시작하고 테스트 에서처럼 코드를 작성하는 방법을 모르겠어요.루비 테스트 작업 방법?
def ftoc(f)
(f - 32)/1.8
end
그리고 터미널에서 레이크 명령에서 실행 :이 시도 내 코드 파일에서
require "temperature"
describe "temperature conversion functions" do
describe "#ftoc" do
it "converts freezing temperature" do
ftoc(32).should == 0
end
it "converts boiling temperature" do
ftoc(212).should == 100
end
it "converts body temperature" do
ftoc(98.6).should == 37
end
it "converts arbitrary temperature" do
ftoc(68).should == 20
end
end
describe "#ctof" do
it "converts freezing temperature" do
ctof(0).should == 32
end
it "converts boiling temperature" do
ctof(100).should == 212
end
it "converts arbitrary temperature" do
ctof(20).should == 68
end
end
end
: 여기에 전체 테스트 파일에서 작업입니다. 레이크
temperature conversion functions
#ftoc
converts freezing temperature
converts boiling temperature
converts body temperature (FAILED - 1)
어떤 책을 배우고 싶으십니까? –
콘솔의 출력은 찾으려는 내용과 실제로 무엇을 발견했는지 알려주고 있어야합니다. 그것은 당신에게 잘못된 것에 대한 단서를 제공해야합니다. – depa
좋습니다. 코드에서 "#ftoc"를 어떻게 기술해야합니까? –