gitnesse 0.12.5 → 0.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/README.md +13 -0
- data/config/gitnesse.rb.example +5 -0
- data/features/step_definitions/gitnesse_steps.rb +54 -0
- data/features/support/env.rb +65 -0
- data/features/sync_wiki_features_to_code.feature +29 -0
- data/lib/gitnesse.rb +13 -9
- data/lib/gitnesse/dependencies.rb +3 -2
- data/lib/gitnesse/features.rb +2 -2
- data/lib/gitnesse/hooks.rb +4 -2
- data/lib/gitnesse/tasks.rake +1 -1
- data/lib/gitnesse/version.rb +1 -1
- data/lib/gitnesse/wiki.rb +17 -8
- data/test/lib/gitnesse/configuration_defaults_test.rb +11 -0
- data/test/lib/gitnesse/dependencies_check_test.rb +17 -4
- data/test/lib/gitnesse/strip_results_test.rb +4 -4
- data/test/lib/gitnesse/wiki_append_results_test.rb +50 -0
- metadata +15 -4
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
|
5
5
|
It enables a project to store Cucumber feature stories in a git-based wiki, test them against your code, and then update the wiki with the latest test results.
|
6
6
|
|
7
|
+
The advantage is, that the features are on a wiki, so non-programmers can see them, and edit using the wiki. Hence an awesome bi-directional testing flow between developers and non-developers on a team.
|
8
|
+
|
7
9
|
Conceptually influenced by Fitnesse http://fitnesse.org/ thank you Uncle Bob!
|
8
10
|
|
9
11
|
## Installation
|
@@ -29,6 +31,17 @@ the following to it:
|
|
29
31
|
config.info = "Bob Martin's development laptop"
|
30
32
|
end
|
31
33
|
|
34
|
+
## Git Config
|
35
|
+
|
36
|
+
Gitnesse depends on two values being present in your `gitconfig`: `user.name`
|
37
|
+
and `user.email`. These will be used when annotating test results, and to
|
38
|
+
identify commits you make to the feature wiki. If Gitnesse complains that you
|
39
|
+
don't have these set, you can fix this by entering the following lines in your
|
40
|
+
terminal:
|
41
|
+
|
42
|
+
$ git config --add --global user.name <your_name>
|
43
|
+
$ git config --add --global user.email <your_email>
|
44
|
+
|
32
45
|
## rake tasks
|
33
46
|
|
34
47
|
$ rake gitnesse:pull
|
@@ -0,0 +1,54 @@
|
|
1
|
+
Given /^there is a code repo with cucumber features defined$/ do
|
2
|
+
@repo_dir = File.join(Dir.home, ".gitnesse_repo")
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /^there is a code repo without any cucumber features defined$/ do
|
6
|
+
@repo_dir = File.join(Dir.home, ".gitnesse_repo_no_features")
|
7
|
+
end
|
8
|
+
|
9
|
+
Given /^there is a git wiki with cucumber features defined$/ do
|
10
|
+
@features_dir = File.join(Dir.home, ".gitnesse_features")
|
11
|
+
|
12
|
+
config_file = File.join(@repo_dir, "gitnesse.rb")
|
13
|
+
config = File.read(config_file)
|
14
|
+
config.gsub!(/config\.repository_url.*$/, "config.repository_url = '#{@features_dir}'")
|
15
|
+
File.open(config_file, 'w') { |file| file.puts config }
|
16
|
+
end
|
17
|
+
|
18
|
+
Given /^there is a git wiki without any cucumber features defined$/ do
|
19
|
+
@features_dir = File.join(Dir.home, ".gitnesse_features_no_features")
|
20
|
+
|
21
|
+
config_file = File.join(@repo_dir, "gitnesse.rb")
|
22
|
+
config = File.read(config_file)
|
23
|
+
config.gsub!(/config\.repository_url.*$/, "config.repository_url = '#{@features_dir}'")
|
24
|
+
File.open(config_file, 'w') { |file| file.puts config }
|
25
|
+
end
|
26
|
+
|
27
|
+
When /^developer pulls feature stories from the wiki$/ do
|
28
|
+
Dir.chdir(@repo_dir) do
|
29
|
+
`bundle exec rake gitnesse:pull &> /dev/null`
|
30
|
+
assert_equal $?, 0
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
When /^developer pushes feature stories to the wiki$/ do
|
35
|
+
Dir.chdir(@repo_dir) do
|
36
|
+
`bundle exec rake gitnesse:push &> /dev/null`
|
37
|
+
assert_equal $?, 0
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
Then /^the feature stories within the code should match the wiki$/ do
|
42
|
+
assert_dir = File.join(Dir.home, ".gitnesse_features_for_assert")
|
43
|
+
|
44
|
+
`git clone #{@features_dir} #{assert_dir} &> /dev/null`
|
45
|
+
|
46
|
+
repo_features = Dir.glob("#{@repo_dir}/features/*.feature").map { |file| File.basename(file, ".feature") }
|
47
|
+
wiki_files = Dir.glob("#{assert_dir}/*.md").map { |file| File.basename(file, ".md") }
|
48
|
+
|
49
|
+
FileUtils.rm_rf(assert_dir)
|
50
|
+
|
51
|
+
repo_features.each do |feature|
|
52
|
+
assert(wiki_files.include?(feature) || wiki_files.include?("#{feature}.feature"))
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'test/unit/assertions'
|
2
|
+
World(Test::Unit::Assertions)
|
3
|
+
|
4
|
+
puts " Setting up Gitnesse for testing..."
|
5
|
+
|
6
|
+
@features_dir = File.join(Dir.home, ".gitnesse_features")
|
7
|
+
@features_dir_no_features = File.join(Dir.home, ".gitnesse_features_no_features")
|
8
|
+
@repo_dir = File.join(Dir.home, ".gitnesse_repo")
|
9
|
+
@repo_dir_no_features = File.join(Dir.home, ".gitnesse_repo_no_features")
|
10
|
+
|
11
|
+
Dir.mkdir @features_dir
|
12
|
+
Dir.mkdir @repo_dir
|
13
|
+
Dir.mkdir @features_dir_no_features
|
14
|
+
Dir.mkdir @repo_dir_no_features
|
15
|
+
|
16
|
+
Dir.chdir(@features_dir) do
|
17
|
+
system('git clone --bare https://github.com/hybridgroup/gitnesse-demo.wiki.git . &> /dev/null')
|
18
|
+
if $? == 0
|
19
|
+
puts " Cloned demo features to #{@features_dir}."
|
20
|
+
else
|
21
|
+
abort " Failed to clone demo features to #{@features_dir}."
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Dir.chdir(@features_dir_no_features) do
|
26
|
+
system('git init --bare &> /dev/null')
|
27
|
+
if $? == 0
|
28
|
+
puts " Created demo wiki without features in #{@features_dir_no_features}."
|
29
|
+
else
|
30
|
+
abort " Failed to create demo wiki without features in #{@features_dir_no_features}."
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
Dir.chdir(@repo_dir) do
|
35
|
+
system('git clone https://github.com/hybridgroup/gitnesse-example-sinatra.git . &> /dev/null')
|
36
|
+
if $? == 0
|
37
|
+
puts " Cloned demo repo to #{@repo_dir}."
|
38
|
+
else
|
39
|
+
abort " Failed to clone demo repo to #{@repo_dir}."
|
40
|
+
end
|
41
|
+
|
42
|
+
system('bundle install --path vendor/bundle &> /dev/null')
|
43
|
+
if $? == 0
|
44
|
+
puts " Installed gems for demo wiki."
|
45
|
+
else
|
46
|
+
abort " Failed to install gems for demo wiki."
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
Dir.chdir(@repo_dir_no_features) do
|
51
|
+
FileUtils.cp_r("#{@repo_dir}/.", @repo_dir_no_features)
|
52
|
+
Dir.glob("#{@repo_dir_no_features}/**/*.feature") do |file|
|
53
|
+
File.unlink(file)
|
54
|
+
end
|
55
|
+
puts " Created demo repo without features."
|
56
|
+
end
|
57
|
+
|
58
|
+
puts " Finished setting up Gitnesse for testing. Running features.", ""
|
59
|
+
|
60
|
+
at_exit do
|
61
|
+
FileUtils.rm_rf(@features_dir)
|
62
|
+
FileUtils.rm_rf(@repo_dir)
|
63
|
+
FileUtils.rm_rf(@features_dir_no_features)
|
64
|
+
FileUtils.rm_rf(@repo_dir_no_features)
|
65
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Feature:
|
2
|
+
In order to build software that provides the best fitting solution to a user problem
|
3
|
+
As a developer
|
4
|
+
I want to be able to test feature stories in my code
|
5
|
+
And also store the feature stories in a wiki so users can easily view or edit them
|
6
|
+
|
7
|
+
Scenario: Features already exist in wiki but not in code
|
8
|
+
Given there is a code repo without any cucumber features defined
|
9
|
+
And there is a git wiki with cucumber features defined
|
10
|
+
When developer pulls feature stories from the wiki
|
11
|
+
Then the feature stories within the code should match the wiki
|
12
|
+
|
13
|
+
Scenario: Features already exist in code but not in wiki
|
14
|
+
Given there is a code repo with cucumber features defined
|
15
|
+
And there is a git wiki without any cucumber features defined
|
16
|
+
When developer pushes feature stories to the wiki
|
17
|
+
Then the feature stories within the code should match the wiki
|
18
|
+
|
19
|
+
Scenario: Features pushes features from code to existing wiki
|
20
|
+
Given there is a code repo with cucumber features defined
|
21
|
+
And there is a git wiki with cucumber features defined
|
22
|
+
When developer pushes feature stories to the wiki
|
23
|
+
Then the feature stories within the code should match the wiki
|
24
|
+
|
25
|
+
Scenario: Features pulls features from wiki to existing code
|
26
|
+
Given there is a code repo with cucumber features defined
|
27
|
+
And there is a git wiki with cucumber features defined
|
28
|
+
When developer pulls feature stories from the wiki
|
29
|
+
Then the feature stories within the code should match the wiki
|
data/lib/gitnesse.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
require 'gollum'
|
3
3
|
require 'fileutils'
|
4
|
+
require 'pathname'
|
4
5
|
require 'tmpdir'
|
5
6
|
require 'gitnesse/configuration'
|
6
7
|
require 'gitnesse/git_config'
|
@@ -31,7 +32,7 @@ module Gitnesse
|
|
31
32
|
def run
|
32
33
|
if pull
|
33
34
|
Hooks.create
|
34
|
-
puts "Now going to run
|
35
|
+
puts "\n Now going to run Cucumber."
|
35
36
|
exec("cucumber #{Gitnesse.configuration.target_directory}/*.feature")
|
36
37
|
end
|
37
38
|
end
|
@@ -39,7 +40,7 @@ module Gitnesse
|
|
39
40
|
def push_results
|
40
41
|
if push
|
41
42
|
Hooks.create
|
42
|
-
puts "Now going to run
|
43
|
+
puts "\n Now going to run Cucumber."
|
43
44
|
exec("cucumber #{Gitnesse.configuration.target_directory}/*.feature")
|
44
45
|
end
|
45
46
|
end
|
@@ -48,7 +49,9 @@ module Gitnesse
|
|
48
49
|
def pull
|
49
50
|
Dependencies.check
|
50
51
|
|
51
|
-
|
52
|
+
relative_path = Pathname.new(Gitnesse.configuration.target_directory).relative_path_from(Pathname.new(Dir.pwd))
|
53
|
+
|
54
|
+
puts " Pulling features into ./#{relative_path} from #{Gitnesse.configuration.repository_url}."
|
52
55
|
Dir.mktmpdir do |tmp_dir|
|
53
56
|
if clone_feature_repo(tmp_dir)
|
54
57
|
FileUtils.mkdir(Gitnesse.configuration.target_directory) unless File.exists?(Gitnesse.configuration.target_directory)
|
@@ -62,7 +65,7 @@ module Gitnesse
|
|
62
65
|
end
|
63
66
|
end
|
64
67
|
end
|
65
|
-
puts "
|
68
|
+
puts " \e[32mDone pulling features.\e[0m"
|
66
69
|
true
|
67
70
|
end
|
68
71
|
|
@@ -71,7 +74,9 @@ module Gitnesse
|
|
71
74
|
Dependencies.check
|
72
75
|
generate_commit_info
|
73
76
|
|
74
|
-
|
77
|
+
relative_path = Pathname.new(Gitnesse.configuration.target_directory).relative_path_from(Pathname.new(Dir.pwd))
|
78
|
+
|
79
|
+
puts " Pushing features from ./#{relative_path} to #{Gitnesse.configuration.repository_url}."
|
75
80
|
Dir.mktmpdir do |tmp_dir|
|
76
81
|
if clone_feature_repo(tmp_dir)
|
77
82
|
feature_files = Dir.glob("#{Gitnesse.configuration.target_directory}/*.feature")
|
@@ -79,17 +84,16 @@ module Gitnesse
|
|
79
84
|
|
80
85
|
# push the changes to the remote git
|
81
86
|
Dir.chdir(tmp_dir) do
|
82
|
-
|
87
|
+
`git push origin master &> /dev/null`
|
83
88
|
end
|
84
89
|
end
|
85
90
|
end
|
86
|
-
puts "
|
91
|
+
puts " \e[32mDone pushing features.\e[0m"
|
87
92
|
true
|
88
93
|
end
|
89
94
|
|
90
95
|
def clone_feature_repo(dir)
|
91
|
-
output = `git clone #{Gitnesse.configuration.repository_url} #{dir}
|
92
|
-
puts output
|
96
|
+
output = `git clone #{Gitnesse.configuration.repository_url} #{dir} &> /dev/null`
|
93
97
|
$?.success?
|
94
98
|
end
|
95
99
|
|
@@ -11,16 +11,17 @@ module Gitnesse
|
|
11
11
|
check_git
|
12
12
|
check_cucumber
|
13
13
|
check_repository_url
|
14
|
+
check_annotation_info
|
14
15
|
end
|
15
16
|
|
16
17
|
protected
|
17
18
|
|
18
19
|
def self.check_git
|
19
|
-
raise NoGitError, "git not found or not working." unless Kernel.system("git --version")
|
20
|
+
raise NoGitError, "git not found or not working." unless Kernel.system("git --version &> /dev/null")
|
20
21
|
end
|
21
22
|
|
22
23
|
def self.check_cucumber
|
23
|
-
raise NoCucumberError, "cucumber not found or not working." unless Kernel.system("cucumber --version")
|
24
|
+
raise NoCucumberError, "cucumber not found or not working." unless Kernel.system("cucumber --version &> /dev/null")
|
24
25
|
end
|
25
26
|
|
26
27
|
def self.check_repository_url
|
data/lib/gitnesse/features.rb
CHANGED
@@ -25,11 +25,11 @@ module Gitnesse
|
|
25
25
|
features = ''
|
26
26
|
|
27
27
|
name, content = page_features.shift
|
28
|
-
puts "
|
28
|
+
puts " \e[32m\e[1mPulling Feature: \e[0m#{name}"
|
29
29
|
features += content
|
30
30
|
|
31
31
|
page_features.each do |name, feature|
|
32
|
-
puts "
|
32
|
+
puts " \e[33m\e[1mDiscarding Feature: \e[0m#{name}"
|
33
33
|
end
|
34
34
|
|
35
35
|
features
|
data/lib/gitnesse/hooks.rb
CHANGED
@@ -9,7 +9,7 @@ module Gitnesse
|
|
9
9
|
Gitnesse::Configuration.load_using_search
|
10
10
|
FileUtils.rm_rf(@dir) if File.directory?(@dir)
|
11
11
|
Dir.mkdir(@dir)
|
12
|
-
`git clone #{Gitnesse.configuration.repository_url} #{@dir}`
|
12
|
+
`git clone #{Gitnesse.configuration.repository_url} #{@dir} &> /dev/null`
|
13
13
|
Wiki.new(@dir).remove_past_results
|
14
14
|
end
|
15
15
|
|
@@ -17,12 +17,14 @@ module Gitnesse
|
|
17
17
|
#
|
18
18
|
# Returns nothing
|
19
19
|
def self.teardown
|
20
|
+
puts " Pushing Cucumber results to wiki."
|
20
21
|
Dir.chdir(@dir) do
|
21
|
-
`git push origin master`
|
22
|
+
`git push origin master &> /dev/null`
|
22
23
|
end
|
23
24
|
|
24
25
|
FileUtils.rm_rf(@dir)
|
25
26
|
FileUtils.rm(File.absolute_path("#{Gitnesse.configuration.target_directory}/support/gitnesse_hooks.rb"))
|
27
|
+
puts " Done."
|
26
28
|
end
|
27
29
|
|
28
30
|
# Public: Adds hooks into Cucumber
|
data/lib/gitnesse/tasks.rake
CHANGED
@@ -21,7 +21,7 @@ namespace :gitnesse do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
desc "Push features to remote git wiki repository, run cucumber, and push results to wiki"
|
24
|
-
task :
|
24
|
+
task :push_results => :environment do
|
25
25
|
Gitnesse::Configuration.load_using_search
|
26
26
|
Gitnesse.push_results
|
27
27
|
end
|
data/lib/gitnesse/version.rb
CHANGED
data/lib/gitnesse/wiki.rb
CHANGED
@@ -108,7 +108,7 @@ module Gitnesse
|
|
108
108
|
def strip_results(content)
|
109
109
|
if content.match(/\u0060{3}gherkin.*\u0060{3}(.*)/m)[1]
|
110
110
|
[ "FAILED", "PASSED", "PENDING", "UNDEFINED" ].each do |type|
|
111
|
-
content.gsub!(/\n
|
111
|
+
content.gsub!(/\n*\!\[\]\(.*\) \`Last result was #{type}: .*\n*/, '')
|
112
112
|
end
|
113
113
|
end
|
114
114
|
content
|
@@ -118,20 +118,29 @@ module Gitnesse
|
|
118
118
|
#
|
119
119
|
# scenario - Cucumber scenario from After hook
|
120
120
|
#
|
121
|
-
# Returns
|
121
|
+
# Returns a string containing the scenario result
|
122
122
|
def append_results(scenario)
|
123
|
-
pages = @wiki.pages
|
124
123
|
filename = File.basename(scenario.feature.file, ".feature")
|
125
124
|
@commit_info[:message] = Gitnesse.configuration.info
|
126
125
|
|
127
|
-
pages.each do |page|
|
126
|
+
self.pages.each do |page|
|
128
127
|
if page.name == filename || page.name == "#{filename}.feature"
|
129
128
|
if page.text_data.include? scenario.name
|
130
129
|
content = page.raw_data
|
131
|
-
|
130
|
+
|
131
|
+
case scenario.status
|
132
|
+
when :undefined then image = ""
|
133
|
+
when :passed then image = ""
|
134
|
+
when :failed then image = ""
|
135
|
+
when :pending then image = ""
|
136
|
+
else image = ""
|
137
|
+
end
|
138
|
+
|
139
|
+
string = "\n#{image} \`Last result was #{scenario.status.to_s.upcase}: #{scenario.name} (#{Time.now.to_s} - #{Gitnesse.configuration.info})\`\n"
|
132
140
|
content.gsub(string, '')
|
133
141
|
content << string
|
134
142
|
@wiki.update_page(page, page.name, :markdown, content, @commit_info)
|
143
|
+
return string
|
135
144
|
end
|
136
145
|
end
|
137
146
|
end
|
@@ -148,7 +157,7 @@ module Gitnesse
|
|
148
157
|
def create_wiki_page(name, content)
|
149
158
|
new_page_content = build_page_content(content)
|
150
159
|
@wiki.write_page(name, :markdown, new_page_content, @commit_info)
|
151
|
-
puts "
|
160
|
+
puts " \e[32mCreated page \e[0m#{name}."
|
152
161
|
end
|
153
162
|
|
154
163
|
# Private: Updates a wiki page with the provided name and content
|
@@ -163,10 +172,10 @@ module Gitnesse
|
|
163
172
|
new_page_content = build_page_content(feature_content, wiki_page_content)
|
164
173
|
|
165
174
|
if new_page_content == wiki_page_content
|
166
|
-
puts "
|
175
|
+
puts " \e[32mPage \e[0m#{page_name} \e[32mdidn't change\e[0m."
|
167
176
|
else
|
168
177
|
@wiki.update_page(wiki_page, page_name, :markdown, new_page_content, @commit_info)
|
169
|
-
puts "
|
178
|
+
puts " \e[33mUpdated page \e[0m#{page_name}."
|
170
179
|
end
|
171
180
|
end
|
172
181
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative '../../test_helper'
|
2
|
+
|
3
|
+
describe Gitnesse::Configuration do
|
4
|
+
describe "defaults" do
|
5
|
+
subject { Gitnesse::Configuration.new }
|
6
|
+
it { subject.branch.must_equal "master" }
|
7
|
+
it { subject.annotate_results.must_equal false }
|
8
|
+
it { subject.info.must_be_nil }
|
9
|
+
it { subject.target_directory.must_equal File.join(Dir.pwd, "features") }
|
10
|
+
end
|
11
|
+
end
|
@@ -1,6 +1,19 @@
|
|
1
1
|
require_relative '../../test_helper'
|
2
2
|
|
3
3
|
describe Gitnesse::Dependencies do
|
4
|
+
describe "#check" do
|
5
|
+
before do
|
6
|
+
Gitnesse::Dependencies.expects(:check_git)
|
7
|
+
Gitnesse::Dependencies.expects(:check_cucumber)
|
8
|
+
Gitnesse::Dependencies.expects(:check_repository_url)
|
9
|
+
Gitnesse::Dependencies.expects(:check_annotation_info)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "calls the other check functions" do
|
13
|
+
Gitnesse::Dependencies.check
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
4
17
|
describe "#check_repository_url" do
|
5
18
|
let(:method) { lambda { Gitnesse::Dependencies.check_repository_url } }
|
6
19
|
|
@@ -19,12 +32,12 @@ describe Gitnesse::Dependencies do
|
|
19
32
|
let(:method) { lambda { Gitnesse::Dependencies.check_git } }
|
20
33
|
|
21
34
|
describe "when git is not installed" do
|
22
|
-
before { Kernel.expects(:system).with("git --version").returns(false) }
|
35
|
+
before { Kernel.expects(:system).with("git --version &> /dev/null").returns(false) }
|
23
36
|
it { method.must_raise(Gitnesse::Dependencies::NoGitError) }
|
24
37
|
end
|
25
38
|
|
26
39
|
describe "when git is installed" do
|
27
|
-
before { Kernel.expects(:system).with("git --version").returns(true) }
|
40
|
+
before { Kernel.expects(:system).with("git --version &> /dev/null").returns(true) }
|
28
41
|
it { method.call.must_be_nil }
|
29
42
|
end
|
30
43
|
end
|
@@ -33,12 +46,12 @@ describe Gitnesse::Dependencies do
|
|
33
46
|
let(:method) { lambda { Gitnesse::Dependencies.check_cucumber } }
|
34
47
|
|
35
48
|
describe "when cucumber is not installed" do
|
36
|
-
before { Kernel.expects(:system).with("cucumber --version").returns(false) }
|
49
|
+
before { Kernel.expects(:system).with("cucumber --version &> /dev/null").returns(false) }
|
37
50
|
it { method.must_raise(Gitnesse::Dependencies::NoCucumberError) }
|
38
51
|
end
|
39
52
|
|
40
53
|
describe "when cucumber is installed" do
|
41
|
-
before { Kernel.expects(:system).with("cucumber --version").returns(true) }
|
54
|
+
before { Kernel.expects(:system).with("cucumber --version &> /dev/null").returns(true) }
|
42
55
|
it { method.call.must_be_nil }
|
43
56
|
end
|
44
57
|
end
|
@@ -16,13 +16,13 @@ Feature: Division
|
|
16
16
|
When I divide
|
17
17
|
Then the result should be 3
|
18
18
|
```
|
19
|
-
`Last result was UNDEFINED: Divide two numbers`
|
19
|
+
 `Last result was UNDEFINED: Divide two numbers`
|
20
20
|
|
21
|
-
`Last result was PENDING: Divide two numbers`
|
21
|
+
 `Last result was PENDING: Divide two numbers`
|
22
22
|
|
23
|
-
`Last result was FAILED: Divide two numbers`
|
23
|
+
 `Last result was FAILED: Divide two numbers`
|
24
24
|
|
25
|
-
`Last result was PASSED: Divide two numbers`
|
25
|
+
 `Last result was PASSED: Divide two numbers`
|
26
26
|
EOS
|
27
27
|
end
|
28
28
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require_relative '../../test_helper'
|
2
|
+
|
3
|
+
describe Gitnesse::Wiki do
|
4
|
+
describe "#append_results" do
|
5
|
+
let(:dir) { Dir.mktmpdir }
|
6
|
+
let(:wiki) { mock }
|
7
|
+
let(:feature_file) do
|
8
|
+
<<-EOS
|
9
|
+
```gherkin
|
10
|
+
Feature: Addition
|
11
|
+
In order to avoid silly mistakes
|
12
|
+
I want to be told the sum of two numbers
|
13
|
+
|
14
|
+
Scenario: Add two single digit numbers
|
15
|
+
Given I have entered 7 into the calculator
|
16
|
+
And I have entered 5 into the calculator
|
17
|
+
When I add
|
18
|
+
Then the result should be 12 on the screen
|
19
|
+
```
|
20
|
+
EOS
|
21
|
+
end
|
22
|
+
let(:pages) do
|
23
|
+
[
|
24
|
+
stub(
|
25
|
+
:name => "addition",
|
26
|
+
:text_data => feature_file,
|
27
|
+
:raw_data => feature_file
|
28
|
+
)
|
29
|
+
]
|
30
|
+
end
|
31
|
+
let(:cucumber_scenario) do
|
32
|
+
stub(
|
33
|
+
:name => "Add two single digit numbers",
|
34
|
+
:status => :passed,
|
35
|
+
:feature => stub(:file => "addition.feature")
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
let(:method) { lambda { Gitnesse::Wiki.new(dir).append_results(cucumber_scenario) } }
|
40
|
+
|
41
|
+
before do
|
42
|
+
Gollum::Wiki.expects(:new).returns(wiki)
|
43
|
+
wiki.expects(:pages).returns(pages)
|
44
|
+
wiki.expects(:update_page).returns(true)
|
45
|
+
File.expects(:basename).returns("addition")
|
46
|
+
end
|
47
|
+
|
48
|
+
it { puts method.call.must_include "Last result was PASSED: Add two single digit numbers" }
|
49
|
+
end
|
50
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitnesse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -121,6 +121,10 @@ files:
|
|
121
121
|
- README.md
|
122
122
|
- Rakefile
|
123
123
|
- bin/gitnesse
|
124
|
+
- config/gitnesse.rb.example
|
125
|
+
- features/step_definitions/gitnesse_steps.rb
|
126
|
+
- features/support/env.rb
|
127
|
+
- features/sync_wiki_features_to_code.feature
|
124
128
|
- gitnesse.gemspec
|
125
129
|
- lib/gitnesse.rb
|
126
130
|
- lib/gitnesse/configuration.rb
|
@@ -136,6 +140,7 @@ files:
|
|
136
140
|
- lib/gitnesse/wiki.rb
|
137
141
|
- test/lib/gitnesse/build_page_content_test.rb
|
138
142
|
- test/lib/gitnesse/commit_info_test.rb
|
143
|
+
- test/lib/gitnesse/configuration_defaults_test.rb
|
139
144
|
- test/lib/gitnesse/configuration_to_hash_test.rb
|
140
145
|
- test/lib/gitnesse/custom_branch_test.rb
|
141
146
|
- test/lib/gitnesse/dependencies_check_test.rb
|
@@ -145,6 +150,7 @@ files:
|
|
145
150
|
- test/lib/gitnesse/read_git_config_test.rb
|
146
151
|
- test/lib/gitnesse/strip_results_test.rb
|
147
152
|
- test/lib/gitnesse/version_test.rb
|
153
|
+
- test/lib/gitnesse/wiki_append_results_test.rb
|
148
154
|
- test/lib/gitnesse/write_file_test.rb
|
149
155
|
- test/test_helper.rb
|
150
156
|
- test/wiki_test_helper.rb
|
@@ -162,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
168
|
version: '0'
|
163
169
|
segments:
|
164
170
|
- 0
|
165
|
-
hash:
|
171
|
+
hash: 3165279517982023743
|
166
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
173
|
none: false
|
168
174
|
requirements:
|
@@ -171,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
177
|
version: '0'
|
172
178
|
segments:
|
173
179
|
- 0
|
174
|
-
hash:
|
180
|
+
hash: 3165279517982023743
|
175
181
|
requirements: []
|
176
182
|
rubyforge_project:
|
177
183
|
rubygems_version: 1.8.24
|
@@ -179,8 +185,12 @@ signing_key:
|
|
179
185
|
specification_version: 3
|
180
186
|
summary: Features on git-based Wiki!
|
181
187
|
test_files:
|
188
|
+
- features/step_definitions/gitnesse_steps.rb
|
189
|
+
- features/support/env.rb
|
190
|
+
- features/sync_wiki_features_to_code.feature
|
182
191
|
- test/lib/gitnesse/build_page_content_test.rb
|
183
192
|
- test/lib/gitnesse/commit_info_test.rb
|
193
|
+
- test/lib/gitnesse/configuration_defaults_test.rb
|
184
194
|
- test/lib/gitnesse/configuration_to_hash_test.rb
|
185
195
|
- test/lib/gitnesse/custom_branch_test.rb
|
186
196
|
- test/lib/gitnesse/dependencies_check_test.rb
|
@@ -190,6 +200,7 @@ test_files:
|
|
190
200
|
- test/lib/gitnesse/read_git_config_test.rb
|
191
201
|
- test/lib/gitnesse/strip_results_test.rb
|
192
202
|
- test/lib/gitnesse/version_test.rb
|
203
|
+
- test/lib/gitnesse/wiki_append_results_test.rb
|
193
204
|
- test/lib/gitnesse/write_file_test.rb
|
194
205
|
- test/test_helper.rb
|
195
206
|
- test/wiki_test_helper.rb
|