0
다음과 같이 rspec에서 해당 메서드를 사용할 때 its(:code) { should eql(0)}
은 무엇을 의미합니까? "그것"참조 것처럼 그때의 주석 다음 its(:code)
에 선 나는 다음과 같은 출력을 얻을Rspecs "#its"방법의 제목은 무엇입니까
AdminlwController Countries API Reply - should be an instance of Api::GetCountryListReply AdminlwController Countries API Reply Country List - should be an instance of Array - should have 2 items - should have countries in the list AdminlwController Countries API Reply result status - should be an instance of Api::SoapStatus - should have a code of 0 - should have an empty errors array AdminlwController Countries API Reply result status code - should be empty (FAILED - 1) 1) NoMethodError in 'AdminlwController Countries API Reply result status code should be empty' undefined method code for <AdminlwController:0x40fc4dc> /Users/steveweet/romad_current/romad/spec/controllers/adminlw_controller_spec.rb:29: Finished in 0.741599 seconds 8 examples, 1 failure
것 같다 경우
나는
describe AdminlwController do
shared_examples_for "valid status" do
it { should be_an_instance_of(Api::SoapStatus) }
it "should have a code of 0" do
subject.code.should eql(0)
end
it "should have an empty errors array" do
subject.errors.should be_an(Array)
subject.errors.should be_empty
end
#its(:code) { should eql(0)}
end
describe "Countries API Reply" do
before :each do
co1 = Factory(:country)
co2 = Factory(:country)
@result = invoke :GetCountryList, "empty_auth"
end
subject { @result }
it { should be_an_instance_of(Api::GetCountryListReply) }
describe "Country List" do
subject {@result.country_list}
it { should be_an_instance_of(Array) }
it { should have(2).items }
it "should have countries in the list" do
subject.each {|c| c.should be_an_instance_of(Api::Country)}
end
end
describe "result status" do
subject { @result.status }
it_should_behave_like "valid status"
end
end
그러나 잘 작동 다음과 같은 사양을 가지고 현재 테스트 대상이 아닌 AdminLwController와 같은 전체 테스트의 주제에 대한 것입니다.
내가 잘못했거나 Rspec 기묘합니까?