hiptest-publisher 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c1155b3c760b808f520f67b8cffa852f912c063
4
- data.tar.gz: c5b26407fdf66c3b8efa06d39c2d49a430d1e049
3
+ metadata.gz: a2ff41b7c9dc93dcb8b49350c24f3136a85f894f
4
+ data.tar.gz: bc289f734743edfc2f747b70228e2d91e8a55101
5
5
  SHA512:
6
- metadata.gz: aa8dbbdbf2a921a25213a7896b8f62e2502006ef617515bf1dcf3d8557a02c928734a17fc214e6906df269c6704773a6b0cfc90634be33686e5d7d133fd11e3c
7
- data.tar.gz: b9755d31e4c6cd9a5a154eedb701badb0887db5e8817e505b157d4f7f60b0b6a0f6dd539801b9e7c035304b4979eb17d2025275574cc6d5cafe693845f0dd35f
6
+ metadata.gz: ca7ebf3223fea589aff7178c6ca1d4c9ac82ae774f5e4d0265a7e5f13f8af7cd5f9b41915a6cc5e2ec2f3b26a8bebb8e93fbcc20a805e984927e19f5908287a3
7
+ data.tar.gz: 455b088226407bce83772840057b52b7472a19b1ca5d6db27e234e0e6ed5f9705374b0436b8eb99650a9dd7b8996cd5e03301beaf0a054c2de0ff2280398df10
@@ -197,28 +197,33 @@ module Hiptest
197
197
  end
198
198
 
199
199
  unless diff[:deleted].nil?
200
- puts "#{diff[:deleted].length} action words deleted:"
200
+ puts "#{pluralize(diff[:deleted].length, "action word")} deleted:"
201
201
  puts diff[:deleted].map {|d| "- #{d[:name]}"}.join("\n")
202
202
  puts ""
203
203
  end
204
204
 
205
205
  unless diff[:created].nil?
206
- puts "#{diff[:created].length} action words created:"
206
+ puts "#{pluralize(diff[:created].length, "action word")} created:"
207
207
  puts diff[:created].map {|c| "- #{c[:name]}"}.join("\n")
208
208
  puts ""
209
209
  end
210
210
 
211
211
  unless diff[:renamed].nil?
212
- puts "#{diff[:renamed].length} action words renamed:"
212
+ puts "#{pluralize(diff[:renamed].length, "action word")} renamed:"
213
213
  puts diff[:renamed].map {|r| "- #{r[:name]} => #{r[:new_name]}"}.join("\n")
214
214
  puts ""
215
215
  end
216
216
 
217
217
  unless diff[:signature_changed].nil?
218
- puts "#{diff[:signature_changed].length} action words which signature changed:"
218
+ puts "#{pluralize(diff[:signature_changed].length, "action word")} which signature changed:"
219
219
  puts diff[:signature_changed].map {|c| "- #{c[:name]}"}.join("\n")
220
220
  puts ""
221
221
  end
222
+
223
+ if diff.empty?
224
+ puts "No action words changed"
225
+ puts ""
226
+ end
222
227
  end
223
228
 
224
229
  def export
@@ -14,20 +14,24 @@ module Hiptest
14
14
 
15
15
  def update_calls
16
16
  @project.find_sub_nodes(Hiptest::Nodes::Call).each do |call|
17
- call.children[:gherkin_text] ||= "#{annotation(call)} #{prettified(call)}"
17
+ call.children[:gherkin_text] ||= "#{text_annotation(call)} #{prettified(call)}"
18
18
  if actionword = get_actionword(call)
19
- actionword.children[:gherkin_annotation] ||= annotation(call)
19
+ actionword.children[:gherkin_annotation] ||= code_annotation(call)
20
20
  actionword.children[:gherkin_pattern] ||= pattern(actionword)
21
21
  end
22
22
  end
23
23
  end
24
24
 
25
25
  def annotation(call)
26
- if call.children[:annotation]
27
- call.children[:annotation].capitalize
28
- else
29
- "Given"
30
- end
26
+ call.children[:annotation].capitalize if call.children[:annotation]
27
+ end
28
+
29
+ def text_annotation(call)
30
+ annotation(call) || "*"
31
+ end
32
+
33
+ def code_annotation(call)
34
+ annotation(call) || "Given"
31
35
  end
32
36
 
33
37
  def prettified(call)
@@ -1,3 +1,5 @@
1
+ require 'set'
2
+
1
3
  require 'hiptest-publisher/string'
2
4
  require 'hiptest-publisher/utils'
3
5
  require 'hiptest-publisher/renderer'
@@ -101,6 +101,7 @@ class OptionsParser
101
101
  def self.parse(args)
102
102
  options = OpenStruct.new
103
103
  opt_parser = OptionParser.new do |opts|
104
+ opts.version = hiptest_publisher_version if hiptest_publisher_version
104
105
  opts.banner = "Usage: ruby publisher.rb [options]"
105
106
  opts.separator ""
106
107
  opts.separator "Exports tests from Hiptest for automation."
@@ -9,6 +9,21 @@ rescue
9
9
  '.'
10
10
  end
11
11
 
12
+ def hiptest_publisher_version
13
+ Gem.loaded_specs['hiptest-publisher'].version.to_s
14
+ rescue
15
+ File.read("#{hiptest_publisher_path}/VERSION") if File.exists?("#{hiptest_publisher_path}/VERSION")
16
+ end
17
+
18
+ def pluralize(count, singular)
19
+ word = if count == 1
20
+ singular
21
+ else
22
+ "#{singular}s"
23
+ end
24
+ "#{count} #{word}"
25
+ end
26
+
12
27
  def make_filter(options)
13
28
  ids = options.filter_ids.split(',').map {|id| "filter[]=id:#{id}"}
14
29
  tags = options.filter_tags.split(',').map {|tag| "filter[]=tag:#{tag}"}
@@ -2,6 +2,7 @@
2
2
  filename = 'features.feature'
3
3
  scenario_filename = '%s.feature'
4
4
  indentation = " "
5
+ fallback_template = 'empty'
5
6
 
6
7
  [actionwords]
7
8
  filename = 'step_definitions.rb'
@@ -0,0 +1,3 @@
1
+ # To export your project to Cucumber correctly, please add the option
2
+ # --split-scenarios when calling hiptest-publisher. It will generate one
3
+ # feature file per scenario from your project.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiptest-publisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiptest R&D
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-17 00:00:00.000000000 Z
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -290,6 +290,7 @@ files:
290
290
  - lib/templates/cucumber/empty.hbs
291
291
  - lib/templates/cucumber/output_config
292
292
  - lib/templates/cucumber/parameter.hbs
293
+ - lib/templates/cucumber/scenarios.hbs
293
294
  - lib/templates/cucumber/single_scenario.hbs
294
295
  - lib/templates/cucumber/single_test.hbs
295
296
  - lib/templates/cucumber/step.hbs
@@ -513,7 +514,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
513
514
  version: '0'
514
515
  requirements: []
515
516
  rubyforge_project:
516
- rubygems_version: 2.4.5
517
+ rubygems_version: 2.4.6
517
518
  signing_key:
518
519
  specification_version: 4
519
520
  summary: Export your tests from Hiptest into executable tests.