Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gthorsen/starter_app
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Widmayer & Sue Petersen committed Oct 25, 2013
2 parents 508501e + fd37a6e commit 7ceaac9
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/stories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class StoriesController < ApplicationController

# GET /stories
def index
@stories = Story.all
@stories = Story.bv_descending
end

# GET /stories/1
Expand Down
5 changes: 3 additions & 2 deletions app/models/story.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class Story < ActiveRecord::Base

validates :stakeholder, :goal, :behavior, :project, presence: true
validates_length_of :tag, :maximum => 40


scope :bv_ascending, -> { order("business_value ASC")}
scope :bv_descending, -> { order("business_value DESC")}
belongs_to :project

end
2 changes: 1 addition & 1 deletion app/views/stories/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
</div>

<br>

<%= link_to "Sort the Stories",stories_path%><br>
<%= link_to 'New Story', new_story_path %>
10 changes: 9 additions & 1 deletion features/step_definitions/global_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
expect(page).to have_content 'success'
end

Given(/^"(.*?)" has BV "(.*?)"$/) do |title, bv|
FactoryGirl.create(:story,behavior: title, business_value: bv )
end

Given(/^"(.*?)" has CV "(.*?)"$/) do |title, cv|
FactoryGirl.create(:story,behavior: title, complexity_value: cv )
end

When(/^I select "(.*?)" from "(.*?)"$/) do |option, name|
select(option, :from => name)
end
end
8 changes: 8 additions & 0 deletions features/step_definitions/story/sort_list_view_of_stories.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Then(/^I should see the "(.*?)" before the "(.*?)"$/) do |earlier_content, later_content|
# pending # express the regexp above with the code you wish you had
page.should have_content(earlier_content)
page.should have_content(later_content)

(page.body.index(earlier_content) < page.body.index(later_content)).should be_true

end
14 changes: 14 additions & 0 deletions features/story/sort_view_list_of_stories.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Feature:
In order to decide the priority of listed stories
As a user
I want to see sorted stories on view list

Scenario:
Given I have stories titled "Story1", "Story2"
And "Story1" has BV "1"
And "Story1" has CV "5"
And "Story2" has BV "5"
And "Story2" has CV "1"
When I go to the list of stories
And I click "Sort the Stories"
Then I should see the "Story2" before the "Story1"

0 comments on commit 7ceaac9

Please sign in to comment.