Skip to content
Browse files

Fix issues with features and sync to wiki

  • Loading branch information...
1 parent 4a55a81 commit 67161aaae7cc09f43e72634f66d3da283e69d393 @stewart stewart committed
View
33 features/step_definitions/gitnesse_steps.rb
@@ -1,17 +1,27 @@
+Given /^there is a code repo with cucumber features defined$/ do
+ @repo_dir = File.join(Dir.home, ".gitnesse_repo")
+end
+
+Given /^there is a code repo without any cucumber features defined$/ do
+ @repo_dir = File.join(Dir.home, ".gitnesse_repo_no_features")
+end
+
Given /^there is a git wiki with cucumber features defined$/ do
@features_dir = File.join(Dir.home, ".gitnesse_features")
+
+ config_file = File.join(@repo_dir, "gitnesse.rb")
+ config = File.read(config_file)
+ config.gsub!(/config\.repository_url.*$/, "config.repository_url = '#{@features_dir}'")
+ File.open(config_file, 'w') { |file| file.puts config }
end
Given /^there is a git wiki without any cucumber features defined$/ do
@features_dir = File.join(Dir.home, ".gitnesse_features_no_features")
-end
-Given /^there is a code repo with cucumber features defined$/ do
- @repo_dir = File.join(Dir.home, ".gitnesse_repo")
-end
-
-Given /^there is a code repo without any cucumber features defined$/ do
- @repo_dir = File.join(Dir.home, ".gitnesse_repo_no_features")
+ config_file = File.join(@repo_dir, "gitnesse.rb")
+ config = File.read(config_file)
+ config.gsub!(/config\.repository_url.*$/, "config.repository_url = '#{@features_dir}'")
+ File.open(config_file, 'w') { |file| file.puts config }
end
When /^developer pulls feature stories from the wiki$/ do
@@ -31,17 +41,14 @@
Then /^the feature stories within the code should match the wiki$/ do
assert_dir = File.join(Dir.home, ".gitnesse_features_for_assert")
- Dir.mkdir(assert_dir)
- Dir.chdir(assert_dir) do
- system("git clone #{@features_dir} . &> /dev/null")
- end
+ `git clone #{@features_dir} #{assert_dir} &> /dev/null`
repo_features = Dir.glob("#{@repo_dir}/features/*.feature").map { |file| File.basename(file, ".feature") }
wiki_files = Dir.glob("#{assert_dir}/*.md").map { |file| File.basename(file, ".md") }
+ FileUtils.rm_rf(assert_dir)
+
repo_features.each do |feature|
assert(wiki_files.include?(feature) || wiki_files.include?("#{feature}.feature"))
end
-
- FileUtils.rm_rf(assert_dir)
end
View
8 features/support/env.rb
@@ -47,14 +47,6 @@
end
end
-config_file = File.join(@repo_dir, "gitnesse.rb")
-
-config = File.read(config_file)
-config.gsub!(/config\.repository_url.*$/, "config.repository_url = '#{@features_dir}'")
-File.open(config_file, 'w') { |file| file.puts config }
-
-puts " Updated demo repo configuration to use demo features."
-
Dir.chdir(@repo_dir_no_features) do
FileUtils.cp_r("#{@repo_dir}/.", @repo_dir_no_features)
Dir.glob("#{@repo_dir_no_features}/**/*.feature") do |file|
View
14 features/sync_wiki_features_to_code.feature
@@ -1,25 +1,29 @@
-Feature:
+Feature:
In order to build software that provides the best fitting solution to a user problem
As a developer
I want to be able to test feature stories in my code
And also store the feature stories in a wiki so users can easily view or edit them
- Background:
- Given there is a git wiki with cucumber features defined
- And there is a code repo without any cucumber features defined
-
Scenario: Features already exist in wiki but not in code
+ Given there is a code repo without any cucumber features defined
+ And there is a git wiki with cucumber features defined
When developer pulls feature stories from the wiki
Then the feature stories within the code should match the wiki
Scenario: Features already exist in code but not in wiki
+ Given there is a code repo with cucumber features defined
+ And there is a git wiki without any cucumber features defined
When developer pushes feature stories to the wiki
Then the feature stories within the code should match the wiki
Scenario: Features pushes features from code to existing wiki
+ Given there is a code repo with cucumber features defined
+ And there is a git wiki with cucumber features defined
When developer pushes feature stories to the wiki
Then the feature stories within the code should match the wiki
Scenario: Features pulls features from wiki to existing code
+ Given there is a code repo with cucumber features defined
+ And there is a git wiki with cucumber features defined
When developer pulls feature stories from the wiki
Then the feature stories within the code should match the wiki

0 comments on commit 67161aa

Please sign in to comment.
Something went wrong with that request. Please try again.