Skip to content

Commit

Permalink
only replace profile if it is both same name and tower, not just for …
Browse files Browse the repository at this point in the history
…tower
  • Loading branch information
ryanb committed Jul 17, 2009
1 parent f2eb6f8 commit 3eb4787
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions features/profiles.feature
Expand Up @@ -16,23 +16,23 @@ Feature: Manage Profiles
When I run rubywarrior
Then I should see "Joe - beginner - level 1 - score 0"

Scenario: Another new profile
Scenario: Another new profile on same tower
Given a profile named "Joe" on "beginner"
When I run rubywarrior
And I choose "New" for "profile"
And I choose "intermediate" for "tower"
And I choose "beginner" for "tower"
And I answer "Bob" to "name"
Then I should see "generated"
When I run rubywarrior
Then I should see "Bob - intermediate - level 1 - score 0"
Then I should see "Bob - beginner - level 1 - score 0"

Scenario: Replace profile in same tower (someday support multiple profiles)
Scenario: Replace profile in same tower with same name
Given a profile named "Joe" on "beginner"
When I run rubywarrior
And I choose "New" for "profile"
And I choose "beginner" for "tower"
And I answer "Bill" to "name"
And I answer "Joe" to "name"
And I answer "y" to "replace"
Then I should see "generated"
When I run rubywarrior
Then I should see "Bill - beginner - level 1 - score 0"
Then I should see "Joe - beginner - level 1 - score 0"
2 changes: 1 addition & 1 deletion lib/ruby_warrior/game.rb
Expand Up @@ -136,7 +136,7 @@ def choose_profile # REFACTORME
profile = UI.choose('profile', profiles + [[:new, 'New Profile']])
if profile == :new
profile = new_profile
if profiles.any? { |p| p.tower_path == profile.tower_path }
if profiles.any? { |p| p.player_path == profile.player_path }
if UI.ask("Are you sure you want to replace your existing profile for this tower?")
UI.puts("Replacing existing profile.")
profile
Expand Down

0 comments on commit 3eb4787

Please sign in to comment.