Permalink
Browse files

refactoring of cucumber steps

  • Loading branch information...
1 parent 897a15c commit ec7560aabadc40df791fb8b46267e9bf87160d05 @thoferon committed May 6, 2012
View
2 features/create_repositories.feature
@@ -7,7 +7,7 @@ Feature: Create a new repository
Given a farm
Scenario: New repository
- When I create a repository "new_repo"
+ When I create the repository "new_repo"
Then the farm contains the repository "new_repo"
Scenario: Existing repository
View
8 features/list_repositories.feature
@@ -5,15 +5,15 @@ Feature: List the repositories
Background:
Given a farm
- When I create a repository "repo_one"
- And I create a repository "repo_two"
+ And a repository "repo_one"
+ And a repository "repo_two"
Scenario: I list the farm's repositories
When I list the farm's repositories
Then the list contains "repo_one"
And the list contains "repo_two"
Scenario: With a non-repo directory
- When I create a directory "non_repo"
- And I list the farm's repositories
+ Given a directory "non_repo"
+ When I list the farm's repositories
Then the list doesn't contain "non_repo"
View
26 features/step_definitions/git_farm_steps.rb
@@ -8,48 +8,32 @@
end
Given /^a repository "(.*)"$/ do |repo_name|
- step %Q{I create a repository "#{repo_name}"}
+ step %Q{I create the repository "#{repo_name}"}
end
Given /^a directory "(.*)"$/ do |dir_name|
- step %Q{I create a directory "#{dir_name}"}
+ create_dir dir_name
end
-When /^I create a repository "(.*)"$/ do |repo_name|
+When /^I create the repository "(.*)"$/ do |repo_name|
@farm.create_repository(repo_name)
end
When /^I list the farm\'s repositories$/ do
@list = @farm.repositories
end
-When /^I create a directory "(.*)"$/ do |dir_name|
- create_dir dir_name
-end
-
-When /^I try to create the repository "(.*)"$/ do |repo_name|
- @block = Proc.new {
- step %Q{I create a repository "#{repo_name}"}
- }
-end
-
When /^I delete the repository "(.*)"$/ do |repo_name|
@farm.delete_repository(repo_name)
end
-When /^I try to delete the repository "(.*)"$/ do |repo_name|
- @block = Proc.new {
- step %Q{I delete the repository "#{repo_name}"}
- }
-end
-
When /^I rename the repository "(.*)" "(.*)"$/ do |source, target|
@farm.rename_repository(source, target)
end
-When /^I try to rename the repository "(.*)" "(.*)"$/ do |source, target|
+When /^I try to (.*)$/ do |action|
@block = Proc.new {
- step %Q{I rename the repository "#{source}" "#{target}"}
+ step %Q{I #{action}}
}
end

0 comments on commit ec7560a

Please sign in to comment.