Skip to content

Commit

Permalink
Retrieved Feature names from the parser id so we can use for the url
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidy Lewis committed Nov 14, 2011
1 parent 059d1c1 commit 71f0370
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Expand Up @@ -4,7 +4,7 @@
end

When /^I visit the sample feature page$/ do
visit "/features/sample.feature"
visit "/features/sample-feature"
end

Then /^I should see the feature free\-form narrative$/ do
Expand Down
3 changes: 2 additions & 1 deletion lib/application.rb
Expand Up @@ -12,7 +12,7 @@
get '/features/:feature' do |feature|
features = ListsFeatures.features
features.each do |feature_hash|
@feature = feature_hash if feature_hash["uri"] == "/features/#{feature}"
@feature = feature_hash if feature_hash["id"] == feature
end

get_scenario_urls
Expand All @@ -28,6 +28,7 @@

def get_scenario_urls
@scenario_urls = {}
return unless @feature
if @feature["elements"]
@feature["elements"].each do |element|
if element["type"] == "scenario"
Expand Down
4 changes: 2 additions & 2 deletions spec/application_spec.rb
Expand Up @@ -10,7 +10,7 @@ def app

before do
ListsFeatures.stub!(:features).and_return([
{ "name" => "Sample Feature", "uri" => "/features/sample-feature.feature", "contents" => "feature contents" },
{ "name" => "Sample Feature", "uri" => "/features/sample-feature.feature", "contents" => "feature contents", "id" => "sample-feature" },
{ "name" => "Another Feature", "uri" => "/features/another-feature.feature" },
{ "name" => "Feature With Description", "uri" => "/features/feature-with-description.feature" , "description" => "The Feature Description"},
{ "name" => "Feature With Scenario", "uri" => "/features/feature-with-scenario.feature", "elements" => [{"keyword" => "Scenario", "name" => "The Scenario Name 1"}, { "keyword" => "Scenario", "name" => "The Scenario Name 2"}]},
Expand All @@ -37,7 +37,7 @@ def app

describe "GET /features/feature-name.feature" do
it "should show the feature contents" do
get "/features/sample-feature.feature"
get "/features/sample-feature"
last_response.body.should include "feature contents"
end
end
Expand Down

0 comments on commit 71f0370

Please sign in to comment.