0
안녕하세요, 현재이 오류로 고민하고 있습니다.rspec 공장 단점 짝수 테스트 오류
장애/오류 : FactoryGirl.create (: 가입) NoMethodError : 정의되지 않은 메서드 "AdvtCategories"에 대한`attribute_list ': 문자열
난이 오류에 대한 올바른 해결책을 찾을 수 없습니다. 내가 발견 한 것은 칼럼이 클래스와 같은 이름이라는 제안이었다.
factory :subscription do
association :category, factory: :category, :class => 'AdvtCategory'
user
end
factory :category do
name "MyString"
alias_name "MyString"
number_of_items 1
type ""
end
UPDATE 1 그것은 factory_girl 오류입니다 : 내 테스트
describe Subscription do
context "validations" do
#it { should validate_presence_of :category_id }
it do
FactoryGirl.create(:category)
FactoryGirl.create(:subscription)
should validate_uniqueness_of(:category_id).scoped_to(:user_id)
end
# TODO validator :category_should_exist
end
#it { should belong_to(:user) }
#it { should belong_to(:category) }
#specify { Subscription.per_page.should eq(20) }
end
공장 도움이되지 않았다.
업데이트 2
이 생성에 factory_girl 오류 (그래서 DB 오류를 물론 패스를 구축) 업데이트 된 코드 다른 하나 개의 클래스에서 변경
답변을 게시하고 수락해야합니다. –
아직 해결하지 못했습니다. 빌드 오류를 사용할 때 사라집니다. 그러나 아무 검증도. 업데이트 된 코드 – Elmor