огурцы-рельсы игнорируют path.rb? - PullRequest
1 голос
/ 31 января 2012

Я медленно копаюсь в своем первом приложении для рельсов с Cucumber. Я строю таблицы и теперь хочу редактировать таблицу ReferenceCommodities. Это использует шаблон rails3-cucumber-devise DanielKehoe, найденный на github Вот моя особенность:

Добавление: я хочу отредактировать эти справочные товары, чтобы они могли быть правильными для пользователей.

Scenario Outline: Edit values
Given I am logged in

Given there are Reference Commodities

| Type       | Commodity | Language |
| government | corn   | en |
| government | maize  | sz |


Scenario: Edit Reference Commodities
When I go to the Reference Commodities home page
Then I should see this reference commodity

| Type       | Commodity | Language |
| government | corn   | en |
| government | maize  | sz |

And I click on "edit"

Then I should see the edit page with this reference commodity
| type      | "government" |
| commodity | "corn"       |
| language  | "en"         |

And I fill in the following:
| type      | "private" |
| commodity | "corn"       |
| language  | "en"         |

Then it should edit this Reference Commodity

Вот мое определение шага. Обратите внимание, что у стартера DanielKehoe уже есть тесты на огурец для пользователя, и мои шаги входа в систему указывают на них. Они проходят испытания огурцов.

Given /^I am logged into$/ do
  # table is a Cucumber::Ast::Table
  sign_up valid_user
end

Given /^there are Reference Commodities$/ do |table|
  # table is a Cucumber::Ast::Table
  @reference_commodities = ReferenceCommodity.create!(table.rows_hash)
end

When /^I go to the Reference Commodities home page$/ do
  visit('/reference_commodities/index')
   save_and_open_page
end

Then /^I should see this reference commodity$/ do |table|
  # table is a Cucumber::Ast::Table
  page.should have_content @reference_commodities[:commodity]
end

Чего не хватает, так это перехода к индексу, где вы видите страницу сохранения_и_открытия в капибаре. Он идет на фиктивную страницу в reference_commodities # show, которая на самом деле не отображается в paths.rb. В моем файле маршрутов есть reference_commodities в качестве ресурса. У меня есть действие new и create в более ранней функции, которая, кажется, проходит испытания на огурец. Действие создания действительно имеет redirect_to (@reference_commodities ... options), но, похоже, оно игнорирует то, что я установил в paths.rb?

Вот основная часть моих путей. Rb:

def path_to(page_name)
 case page_name

   when /the Reference Commodities home page/ 
   '/reference_commodities/index'
end

Что я пропускаю, чтобы идти по этому пути? спасибо, Сэм

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...