2009-03-22 4 views
1

I가 TipoContato (테이블 tipos_contato) 나는이 복수형 경우, 그것은 tipo_contatos 될 것이다, 그래서 억양이 추가라는 모델 : 그것은 완벽 콘솔에서 테스트,복수형 테스트에서 버그가 있습니까?

inflect.irregular 'tipo_contato', 'tipos_contato' 

OK :

>> TipoContato 
=> TipoContato(id: integer, descricao: string, created_at: datetime, updated_at: datetime) 

테스트 케이스를 실행할 때, 나는이 오류 얻을 :

ActiveRecord::StatementInvalid: Mysql::Error: Table 'contacts_test.tipo_contatos' doesn't exist: DELETE FROM `tipo_contatos` 

내가 시도 내 테이블을 인식 레일을 강제로 시도를 :

set_table_name 'tipos_contato' 

그리고 나는 매우 동일한 오류가 발생했습니다.

레일 2.3.2

답변

2

그것은 버그,하지만 해결 방법이 있는지 확실하지. 조명기 파일의 이름을 tipos_contato.yml로 변경하십시오. 그래서 같은 단위 테스트에이어서,이 와이어를 :

class TipoContatoTest < ActiveSupport::TestCase 
    set_fixture_class :tipos_contato => TipoContato 
    ... 
end 

여기에서 좀 더 자세하게 설명을 post예요.

관련 문제