From 19c45a9915e78841fb673d42b25e1dfecbb5a666 Mon Sep 17 00:00:00 2001 From: Yomi Colledge Date: Mon, 5 Jul 2010 09:51:34 +0100 Subject: [PATCH] More refactoring to centralise our model instantiation steps --- features/enhanced/hover_functionality.feature | 8 ++++---- features/step_definitions/projects_steps.rb | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/features/enhanced/hover_functionality.feature b/features/enhanced/hover_functionality.feature index e5cb46db..9f140bb4 100644 --- a/features/enhanced/hover_functionality.feature +++ b/features/enhanced/hover_functionality.feature @@ -12,7 +12,7 @@ Feature: Hovering over a project item Scenario: Hovering over a project item from project feature Given the "project" has "features" - When I visit the projects features + When I visit the "projects" "features" And the feature page is loaded And the first feature is hovered over Then the feature's information will be display in the sidebar @@ -32,14 +32,14 @@ Feature: Hovering over a project item Then the story's information will be display in the sidebar Scenario: When viewing a project we must be able to hover of its items - Given the project has features + Given the "project" has "features" And the project is viewed And the first feature is hovered over Then the feature's information will be display in the sidebar Scenario: When viewing a project's feature we must be able to hover of its items - Given the project has features - When I visit the projects features + Given the "project" has "features" + When I visit the "projects" "features" And the first feature is hovered over Then the feature's information will be display in the sidebar diff --git a/features/step_definitions/projects_steps.rb b/features/step_definitions/projects_steps.rb index 42dbc6d8..96d27719 100644 --- a/features/step_definitions/projects_steps.rb +++ b/features/step_definitions/projects_steps.rb @@ -81,7 +81,7 @@ when /project/ @project = Project.find 2 else - raise "Can't find model from \"#{model}\" to a path.\n" + + raise "Can't instantiate \"#{model}\".\n" + "Now, go and add a mapping in #{__FILE__}" end end @@ -123,6 +123,16 @@ visit import_feature_project_path @project end +When /^I visit the "([^\"]*)" "([^\"]*)"$/ do |model, assoc| + case model + when /projects/ + visit features_project_path @project + else + raise "Unable to find path for \"#{model}\" associated to \"#{assoc}\".\n" + + "Now, go and add a mapping in #{__FILE__}" + end +end + Then /^submit the form$/ do click_button 'save' end