2012-01-23 7 views
0

나는 이것이 새로운 Rails 사용자이고 오이를 올바르게하고 싶어서 기본이라고 확신합니다. 나는 주말에 Pragmatic 책을 읽으며 작은 프로젝트를 만들어서 그것을 만들고 사용하고 싶다. 의도적으로 가능한 한 광범위하게 첫 번째 기능을 설정하여 레일 측면에서 작동하는 방식에 따라 너무 부서지기 쉽지 않습니다. DanielKehoe의 github 시동기를 사용하여 새로운 레일 앱을 만들었습니다. 나는 사용자를 알아 냈다고 생각한다. 그러나 내가 오이를 사용하여 상수의 테이블이 될 참조 단위의 첫 번째 테이블을 만들려고 할 때 나는 오이가 나를 참조 단위 모델로 만들 것이라고 예상했지만 나는 아침마다 그것을 사용하여 그렇게하도록했습니다. 책, Railscasts 및 stackoverflow 내가 지금 어디로 나를 밀어. 나는 앞으로 나아가서 참조 단위 (Reference Units)를위한 모델, 새로운 액션과 빈 뷰 (empty view)를 가진 컨트롤러를 생성했다. 하지만 이제는 (LoadError)가있는 참조 단위 모델이 있다는 것을 알 수 없습니다. 이상한 것은 앱에 있기 때문입니다.오이 (LoadError) 내 모델

when /the new Reference Units page/ 
    '/reference_units/new' 
:

Given /^I am logged in as the following user:$/ do |table| 
    sign_up valid_user 
end 

When /^I go to the new Reference Units page$/ do 
    visit new_reference_unit_path 
end 

When /^I fill in the following:$/ do |table| 
    @reference_unit = Reference_unit.create!(table.rows_hash) 
end 

Then /^it should create a new Reference Unit$/ do 
    pending # express the regexp above with the code you wish you had 
end 

new_reference_unit_path는 나의 기능/지원/paths.rb에 : 여기

Feature: I want to have Reference Units that I can refer to so they can be used elsewhere. That way 
they can be updated in one place. I want to create and edit these Units. 

Background: 
Given I am logged in as the following user: 
| name | "Testy McUserton" | 
| password | "please" | 
| email | "[email protected]" | 

Scenario: Adding Reference Units 
When I go to the new Reference Units page 
And I fill in the following: 
| commodity | "corn" | 
| language | "en" | 
| wholesale unit | "xton" | 
| retail unit | "xliter" | 
| receipt unit | "dollar" | 
Then it should create a new Reference Unit 

내 단계 정의입니다 :

여기에 내 현재 기능입니다

실행 3.1.3에서 다음을 적색으로 표시합니다.

Scenario: Adding Reference Units    # features/user_can_create_units.feature:10 
When I go to the new Reference Units page # features/step_definitions/user_create_unit_reference.rb:6 
    Expected /Users/sam/apps/keriakoo/app/models/reference_unit.rb to define Reference_unit (LoadError) 
    ./app/controllers/reference_units_controller.rb:4:in `new' 
    ./features/step_definitions/user_create_unit_reference.rb:7:in `/^I go to the new Reference Units page$/' 
    features/user_can_create_units.feature:11:in `When I go to the new Reference Units page' 

위에서 언급 한 것과 같습니다. reference_unit.rb 파일이 올바른 위치에 있습니다. 물론, 오이가 나를 올바른 시간에 인도 할 것으로 기대하는 어떠한 방법이나 속성도 추가하지 않았습니다. 나는 그것이 단순한 것이라고 확신하지만, 모든 종류의 단어와 대문자 조합을 사용하여 느슨한 것을 흔들어 보았습니다.

답변

0

OK, 나는 단서를 쳤습니다. 주위를 파고, 나는 오이에 - 백 트레이스 옵션을 사용하고 그것은 "const"의 핵심 단어와의 의존성을 지적했다. 좋아, 그것은 텍스트의 무언가를 좋아하지 않는다. 2 단어 모델에 대한 정보를 살펴보면 내 모델이 정확하다는 것을 알 수 있습니다 : ReferenceUnit. 하지만 내 오류 출력을보고, 그것은 Reference_unit 찾고 있었다. 그래서 웃음을 위해 나는 그 단계를위한 정규 표현식을 "새로운 참조 단위 페이지 $로 갈 때"오류가 사라지도록 변경했습니다. 그래서 첫 번째 줄의 구문이 중요합니다. 의심 스럽지만 'freestylin'이 아닙니다.