gurke 2.4.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +4 -0
  3. data/bin/gurke +2 -0
  4. data/features/gurke.feature +2 -5
  5. data/features/gurke.rb +2 -1
  6. data/features/gurke/backtrace_filtering.feature +3 -4
  7. data/features/gurke/context_in_hooks.feature +1 -2
  8. data/features/gurke/filter_by_tags.feature +5 -6
  9. data/features/gurke/include_by_tags.feature +1 -2
  10. data/features/gurke/other_reporter.feature +3 -4
  11. data/features/gurke/pending_steps.feature +1 -4
  12. data/features/gurke/run_specific_directories.feature +4 -5
  13. data/features/gurke/run_specific_scenarios.feature +5 -6
  14. data/features/gurke/step_specific_definitions.feature +1 -4
  15. data/features/support/steps/cli_steps.rb +17 -8
  16. data/features/support/steps/file_steps.rb +2 -9
  17. data/gurke.gemspec +10 -9
  18. data/lib/gurke.rb +3 -0
  19. data/lib/gurke/background.rb +2 -0
  20. data/lib/gurke/builder.rb +10 -11
  21. data/lib/gurke/capybara.rb +2 -0
  22. data/lib/gurke/cli.rb +35 -27
  23. data/lib/gurke/configuration.rb +9 -6
  24. data/lib/gurke/dsl.rb +9 -5
  25. data/lib/gurke/feature.rb +6 -8
  26. data/lib/gurke/feature_list.rb +11 -7
  27. data/lib/gurke/reporter.rb +41 -34
  28. data/lib/gurke/reporters/compact_reporter.rb +137 -0
  29. data/lib/gurke/reporters/default_reporter.rb +57 -16
  30. data/lib/gurke/reporters/null_reporter.rb +4 -2
  31. data/lib/gurke/reporters/team_city_reporter.rb +11 -13
  32. data/lib/gurke/rspec.rb +2 -0
  33. data/lib/gurke/run_list.rb +2 -0
  34. data/lib/gurke/runner.rb +12 -6
  35. data/lib/gurke/scenario.rb +41 -2
  36. data/lib/gurke/step.rb +24 -14
  37. data/lib/gurke/step_definition.rb +3 -1
  38. data/lib/gurke/steps.rb +3 -1
  39. data/lib/gurke/tag.rb +5 -1
  40. data/lib/gurke/version.rb +5 -3
  41. data/spec/gurke/feature_list_spec.rb +4 -2
  42. data/spec/gurke/reporters/default_reporter_spec.rb +201 -0
  43. data/spec/gurke/run_list_spec.rb +2 -0
  44. data/spec/gurke/scenario_spec.rb +5 -3
  45. data/spec/gurke/step_definition_spec.rb +3 -1
  46. data/spec/spec_helper.rb +10 -1
  47. metadata +8 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3b278f4004809102ed988402c3acfc76bb384321
4
- data.tar.gz: 5b7c7c7c16da8c0d32d38359609b1d103ab9a27e
2
+ SHA256:
3
+ metadata.gz: 67753800c554ed5230279ea3fedb0765c04bdbebb23e0adcfe51d39aa171e943
4
+ data.tar.gz: 1272789c4796298eccbea8d1c4b7993d09e5adb67be6d1c9750e7b9fc0c57837
5
5
  SHA512:
6
- metadata.gz: 17bf379d58c686f6e5c3556f308e96ed788354b0dd40b3b3bbc28a91a5c68d3f86b7f206eb44545692c1934dd77a46bbe789bb7b1db60600f81a40702f235daa
7
- data.tar.gz: 13b3ac8d7752110fde3f96c8ed3f7e73b7924cc393f4870f1747444c7f4157e1f50e6a38a291bc6e0a5218afbd4fe48f09aa734e95aab9ff1fcec8fe560e903f
6
+ metadata.gz: 68edef2b0fd8b60b87dca69ac2a6bd2bfbed63ea58d9c0a0484a72e1a4aea5713a673a0eb46b182ba0ffa006002d7db991d5e842504827bea841365e6ffb28cd
7
+ data.tar.gz: 9c3f090fd25a651f46d85e11864d539379af2977c9d2174a3bf23fd542933af388336cd0a7f968d40e2330bab234c792645dd21999e2ac6710e1d422b1c7f9f2
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0
4
+
5
+ * Drop support for MRI < 2.3
6
+
3
7
  ## 2.3.0
4
8
 
5
9
  * Step inclusion can be scoped to specific tags (45cea9ab)
data/bin/gurke CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require 'gurke'
3
5
  require 'gurke/cli'
4
6
 
@@ -3,9 +3,6 @@ Feature: Use gurke
3
3
  In order to run my feature definitions
4
4
  I want to use the gurke command line program
5
5
 
6
- Background:
7
- Given I am in a project using gurke
8
-
9
6
  Scenario: Run a passing feature file
10
7
  Given a file "features/test.feature" with the following content exists
11
8
  """
@@ -20,7 +17,7 @@ Feature: Use gurke
20
17
  end
21
18
  Gurke.configure{|c| c.include TestSteps }
22
19
  """
23
- When I execute "bundle exec gurke"
20
+ When I run the tests
24
21
  Then the program exit code should be null
25
22
  And the program output should include "Feature: F"
26
23
  And the program output should include "Scenario: Scenario A"
@@ -42,6 +39,6 @@ Feature: Use gurke
42
39
  end
43
40
  Gurke.configure{|c| c.include TestSteps }
44
41
  """
45
- When I execute "bundle exec gurke"
42
+ When I run the tests
46
43
  And the program output should include "1 scenarios: 1 failing, 0 pending"
47
44
  Then the program exit code should be non-null
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'gurke/rspec'
2
4
  require 'tmpdir'
3
5
 
4
6
  Gurke.configure do |c|
5
7
  c.around(:scenario) do |scenario|
6
-
7
8
  Dir.mktmpdir('gurke') do |dir|
8
9
  @__root = Pathname.new(dir)
9
10
  scenario.call
@@ -4,7 +4,6 @@ Feature: Backtrace filtering
4
4
  I want to see modified backtraces with only non-library calls
5
5
 
6
6
  Background:
7
- Given I am in a project using gurke
8
7
  And a file "features/test.feature" with the following content exists
9
8
  """
10
9
  Feature: F
@@ -21,16 +20,16 @@ Feature: Backtrace filtering
21
20
  """
22
21
 
23
22
  Scenario: See backtrace without line from libraries
24
- When I execute "bundle exec gurke"
23
+ When I run the tests
25
24
  Then the program output should include "features/support/steps/test_steps.rb:2"
26
25
  Then the program output should not include "gurke/lib/gurke/runner.rb"
27
26
 
28
27
  Scenario: See backtrace when run with --backtrace
29
- When I execute "bundle exec gurke --backtrace"
28
+ When I run the tests with "--backtrace"
30
29
  Then the program output should include "features/support/steps/test_steps.rb:2"
31
30
  Then the program output should include "gurke/lib/gurke/runner.rb"
32
31
 
33
32
  Scenario: See backtrace when run with -b
34
- When I execute "bundle exec gurke -b"
33
+ When I run the tests with "-b"
35
34
  Then the program output should include "features/support/steps/test_steps.rb:2"
36
35
  Then the program output should include "gurke/lib/gurke/runner.rb"
@@ -4,7 +4,6 @@ Feature: Access context in hooks
4
4
  I want to access meta data of the context in hooks
5
5
 
6
6
  Background:
7
- Given I am in a project using gurke
8
7
  And a file "features/test.feature" with the following content exists
9
8
  """
10
9
  Feature: A
@@ -35,5 +34,5 @@ Feature: Access context in hooks
35
34
  """
36
35
 
37
36
  Scenario: Assertions should pass
38
- When I execute all scenarios
37
+ When I run the tests
39
38
  Then all scenarios have passed
@@ -4,7 +4,6 @@ Feature: Backtrace filtering
4
4
  I want to filter features and scenarios by tags to only run a subset
5
5
 
6
6
  Background:
7
- Given I am in a project using gurke
8
7
  And a file "features/support/steps/test_steps.rb" with the following content exists
9
8
  """
10
9
  module TestSteps
@@ -35,35 +34,35 @@ Feature: Backtrace filtering
35
34
  """
36
35
 
37
36
  Scenario: Do not run @wip by default
38
- When I execute "bundle exec gurke"
37
+ When I run the tests
39
38
  Then the program output should include "Feature Flagged little-A"
40
39
  And the program output should include "Feature Flagged little-B"
41
40
  And the program output should not include "Feature Flagged little-WIP"
42
41
  And the program output should include "2 scenarios"
43
42
 
44
43
  Scenario: Filter with positive tag match
45
- When I execute "bundle exec gurke --tags a"
44
+ When I run the tests with "--tags a"
46
45
  Then the program output should include "Feature Flagged little-A"
47
46
  And the program output should not include "Feature Flagged little-B"
48
47
  And the program output should not include "Feature Flagged little-WIP"
49
48
  And the program output should include "1 scenarios"
50
49
 
51
50
  Scenario: Filter with negative tag match
52
- When I execute "bundle exec gurke -t ~b"
51
+ When I run the tests with "-t ~b"
53
52
  Then the program output should include "Feature Flagged little-A"
54
53
  And the program output should not include "Feature Flagged little-B"
55
54
  And the program output should include "Feature Flagged little-WIP"
56
55
  And the program output should include "2 scenarios"
57
56
 
58
57
  Scenario: Filter with multiple tag match and'ed
59
- When I execute "bundle exec gurke --tags c,d"
58
+ When I run the tests with "--tags c,d"
60
59
  Then the program output should include "Feature Flagged little-A"
61
60
  And the program output should include "Feature Flagged little-B"
62
61
  And the program output should not include "Feature Flagged little-WIP"
63
62
  And the program output should include "2 scenarios"
64
63
 
65
64
  Scenario: Filter with multiple tag match or'ed
66
- When I execute "bundle exec gurke --tags b --tags wip"
65
+ When I run the tests with "--tags b --tags wip"
67
66
  Then the program output should not include "Feature Flagged little-A"
68
67
  And the program output should include "Feature Flagged little-B"
69
68
  And the program output should include "Feature Flagged little-WIP"
@@ -4,7 +4,6 @@ Feature: Include by tags
4
4
  I want to include some steps only to scenarios with a specific tags
5
5
 
6
6
  Background:
7
- Given I am in a project using gurke
8
7
  And a file "features/test_a.feature" with the following content exists
9
8
  """
10
9
  @step1a
@@ -59,7 +58,7 @@ Feature: Include by tags
59
58
  """
60
59
 
61
60
  Scenario: It should include the matching step definitions
62
- When I execute "bundle exec gurke"
61
+ When I run the tests
63
62
  Then the program output should include "DO STEP 1A"
64
63
  Then the program output should include "DO STEP 2A"
65
64
  Then the program output should include "DO STEP 1B"
@@ -4,7 +4,6 @@ Feature: Other Reporter
4
4
  I want to pass a command line argument to change the reporter
5
5
 
6
6
  Background:
7
- Given I am in a project using gurke
8
7
  And a file "features/test.feature" with the following content exists
9
8
  """
10
9
  Feature: F
@@ -21,15 +20,15 @@ Feature: Other Reporter
21
20
  """
22
21
 
23
22
  Scenario: Use the default reporter without addition arguments
24
- When I execute "bundle exec gurke"
23
+ When I run the tests
25
24
  Then the program output should not include "##teamcity"
26
25
 
27
26
  Scenario: Use specified reporter when run with --formatter
28
- When I execute "bundle exec gurke --formatter team_city"
27
+ When I run the tests with "--formatter team_city"
29
28
  Then the program output should include "##teamcity[testStarted name='Scenario A']"
30
29
  Then the program output should include "##teamcity[testFinished name='Scenario A']"
31
30
 
32
31
  Scenario: Use specified reporter when run with -f
33
- When I execute "bundle exec gurke -f team_city"
32
+ When I run the tests with "-f team_city"
34
33
  Then the program output should include "##teamcity[testStarted name='Scenario A']"
35
34
  Then the program output should include "##teamcity[testFinished name='Scenario A']"
@@ -1,8 +1,5 @@
1
1
  Feature: Pending Steps
2
2
 
3
- Background:
4
- Given I am in a project using gurke
5
-
6
3
  Scenario: Use same step definition with different keyword
7
4
  Given a file "features/test.feature" with the following content exists
8
5
  """
@@ -11,6 +8,6 @@ Feature: Pending Steps
11
8
  Given I am "John"
12
9
 
13
10
  """
14
- When I execute all scenarios
11
+ When I run the tests
15
12
  Then the program exit code should be null
16
13
  And the program output should include "1 pending"
@@ -4,7 +4,6 @@ Feature: Run specific features or scenarios
4
4
  I want run only feature files from one directory
5
5
 
6
6
  Background:
7
- Given I am in a project using gurke
8
7
  Given a file "features/odd/a.feature" with the following content exists
9
8
  """
10
9
  Feature: F
@@ -46,17 +45,17 @@ Feature: Run specific features or scenarios
46
45
  """
47
46
 
48
47
  Scenario: Run all features from on directory
49
- When I execute "bundle exec gurke features/odd"
48
+ When I run the tests with "features/odd"
50
49
  And the program output should include "2 scenarios: 0 failing, 0 pending"
51
50
 
52
51
  Scenario: Run all features from on directory (II)
53
- When I execute "bundle exec gurke features/even"
52
+ When I run the tests with "features/even"
54
53
  And the program output should include "1 scenarios: 0 failing, 0 pending"
55
54
 
56
55
  Scenario: Run all features from on directory (with subdirectories)
57
- When I execute "bundle exec gurke features"
56
+ When I run the tests with "features"
58
57
  And the program output should include "3 scenarios: 0 failing, 0 pending"
59
58
 
60
59
  Scenario: Run all features from on directory (based on feature pattern)
61
- When I execute "bundle exec gurke trash"
60
+ When I run the tests with "trash"
62
61
  And the program output should include "0 scenarios: 0 failing, 0 pending"
@@ -4,7 +4,6 @@ Feature: Run specific features or scenarios
4
4
  I want run only a specific set of files or lines
5
5
 
6
6
  Background:
7
- Given I am in a project using gurke
8
7
  Given a file "features/a.feature" with the following content exists
9
8
  """
10
9
  Feature: F
@@ -67,26 +66,26 @@ Feature: Run specific features or scenarios
67
66
  """
68
67
 
69
68
  Scenario: Run specific file (I)
70
- When I execute "bundle exec gurke features/a.feature"
69
+ When I run the tests with "features/a.feature"
71
70
  And the program output should include "2 scenarios: 0 failing, 0 pending"
72
71
 
73
72
  Scenario: Run specific file (II)
74
- When I execute "bundle exec gurke features/b.feature"
73
+ When I run the tests with "features/b.feature"
75
74
  And the program output should include "3 scenarios: 0 failing, 0 pending"
76
75
 
77
76
  Scenario: Run specific line of a scenario (I)
78
- When I execute "bundle exec gurke features/b.feature:7"
77
+ When I I run the tests with "features/b.feature:7"
79
78
  And the program output should include "Scenario: Scenario B1"
80
79
  And the program output should include "1 scenarios: 0 failing, 0 pending"
81
80
 
82
81
  Scenario: Run specific line of a scenario (II)
83
- When I execute "bundle exec gurke features/b.feature:7:19"
82
+ When I run the tests with "features/b.feature:7:19"
84
83
  And the program output should include "Scenario: Scenario B1"
85
84
  And the program output should include "Scenario: Scenario B3"
86
85
  And the program output should include "2 scenarios: 0 failing, 0 pending"
87
86
 
88
87
  Scenario: Run specific line of a scenario (III)
89
- When I execute "bundle exec gurke features/a.feature:11 features/b.feature:7:19"
88
+ When I run the tests with "features/a.feature:11 features/b.feature:7:19"
90
89
  And the program output should include "Scenario: Scenario A2"
91
90
  And the program output should include "Scenario: Scenario B1"
92
91
  And the program output should include "Scenario: Scenario B3"
@@ -3,9 +3,6 @@ Feature: Step keyword specific definitions
3
3
  As a user
4
4
  I want to define same steps with different step keywords
5
5
 
6
- Background:
7
- Given I am in a project using gurke
8
-
9
6
  Scenario: Use same step definition with different keyword
10
7
  Given a file "features/test.feature" with the following content exists
11
8
  """
@@ -37,5 +34,5 @@ Feature: Step keyword specific definitions
37
34
  end
38
35
  Gurke.world.send :include, Steps
39
36
  """
40
- When I execute all scenarios
37
+ When I run the tests
41
38
  Then all scenarios have passed
@@ -1,22 +1,31 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'open3'
2
4
 
3
- #
4
5
  module CLISteps
5
- def _execute(exec)
6
+ def _execute(args = nil)
6
7
  Dir.chdir(@__root) do
7
8
  Bundler.with_clean_env do
8
- out, err, status = Open3.capture3('bash', '-lc', exec)
9
+ cmd = ['ruby']
10
+ cmd << '-I' << Gurke.root.join('..', 'lib').realpath
11
+ cmd << '-S' << Gurke.root.join('..', 'bin', 'gurke').realpath
12
+
13
+ unless args.to_s.include?('-f ') || args.to_s.include?('--formatter ')
14
+ cmd << '-f' << 'default'
15
+ end
16
+
17
+ cmd << args.to_s
18
+
19
+ out, err, status = Open3.capture3 cmd.join ' '
9
20
 
10
21
  @last_process = [Integer(status), out, err]
11
22
  end
12
23
  end
13
24
  end
14
25
 
15
- step(/I execute "(.*?)"/, :_execute)
26
+ step(/I run the tests with "(.*?)"/, :_execute)
16
27
 
17
- step('I execute all scenarios') do
18
- _execute 'bundle exec gurke'
19
- end
28
+ step('I run the tests', :_execute)
20
29
 
21
30
  step(/the program exit code should be null/) do
22
31
  expect(@last_process[0]).to eq 0
@@ -37,7 +46,7 @@ module CLISteps
37
46
  end
38
47
 
39
48
  step(/the program output should not include "(.*?)"/,
40
- :_cli_not_include_content)
49
+ :_cli_not_include_content)
41
50
 
42
51
  step(/all scenarios have passed/) do
43
52
  _cli_include_content 'scenarios: 0 failing, 0 pending'
@@ -1,4 +1,5 @@
1
- #
1
+ # frozen_string_literal: true
2
+
2
3
  module FileSteps
3
4
  def _write_file(path, content)
4
5
  file = @__root.join(path)
@@ -13,14 +14,6 @@ module FileSteps
13
14
  File.read(file)
14
15
  end
15
16
 
16
- step(/I am in a project using gurke/) do
17
- _write_file 'Gemfile', <<-EOS
18
- source 'https://rubygems.org'
19
- gem 'gurke', path: '#{File.dirname(Gurke.root)}'
20
- gem 'test-unit'
21
- EOS
22
- end
23
-
24
17
  step(/a file "(.*?)" with the following content exists/) do |path, step|
25
18
  _write_file(path, step.doc_string)
26
19
  end
@@ -1,4 +1,5 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'gurke/version'
@@ -7,27 +8,27 @@ Gem::Specification.new do |spec|
7
8
  spec.name = 'gurke'
8
9
  spec.version = Gurke::VERSION
9
10
  spec.authors = ['Jan Graichen']
10
- spec.email = %w(jg@altimos.de)
11
+ spec.email = %w[jg@altimos.de]
11
12
  spec.homepage = 'https://github.com/jgraichen/gurke'
12
13
  spec.license = 'MIT'
13
14
 
14
15
  spec.description = \
15
- %q(An alternative gherkin feature runner inspired by rspec and turnip.)
16
+ 'An alternative gherkin feature runner inspired by rspec and turnip.'
16
17
  spec.summary = \
17
- %q(An alternative gherkin feature runner inspired by rspec and turnip.)
18
+ 'An alternative gherkin feature runner inspired by rspec and turnip.'
18
19
 
19
20
  spec.files = Dir['**/*'].grep %r{^(
20
21
  (bin/|lib/|test/|spec/|features/)|
21
22
  (\w*\.gemspec|LICENSE.*|README.*|CHANGELOG.*)$
22
23
  )}x
23
24
 
24
- spec.executables = spec.files.grep(/^bin\//) {|f| File.basename(f) }
25
- spec.test_files = spec.files.grep(/^(test|spec|features)\//)
26
- spec.require_paths = %w(lib)
25
+ spec.executables = spec.files.grep(%r{^bin/}) {|f| File.basename(f) }
26
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
27
+ spec.require_paths = %w[lib]
27
28
 
28
- spec.add_dependency 'trollop'
29
- spec.add_dependency 'gherkin', '~> 2.0'
30
29
  spec.add_dependency 'colorize'
30
+ spec.add_dependency 'gherkin', '~> 2.0'
31
+ spec.add_dependency 'trollop'
31
32
 
32
33
  spec.add_development_dependency 'bundler', '~> 1.3'
33
34
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'gurke/version'
2
4
  require 'pathname'
3
5
 
@@ -21,6 +23,7 @@ module Gurke
21
23
 
22
24
  module Reporters
23
25
  require 'gurke/reporters/null_reporter'
26
+ require 'gurke/reporters/compact_reporter'
24
27
  require 'gurke/reporters/default_reporter'
25
28
  require 'gurke/reporters/team_city_reporter'
26
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gurke
2
4
  #
3
5
  class Background