yet-another-cucumber-tcl 0.0.9

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.
@@ -0,0 +1,35 @@
1
+ require 'cucumber'
2
+ require 'cucumber/glue/dsl'
3
+ require_relative 'tcl/activate_steps'
4
+ require_relative 'tcl/framework'
5
+ require_relative 'tcl/step_definitions'
6
+
7
+ module Cucumber
8
+ module Tcl
9
+ extend ::Cucumber::Glue::Dsl
10
+
11
+ # Wrap this in a rescue block so RSpec can load the file without crashing
12
+ begin
13
+ InstallPlugin do |config|
14
+ Cucumber::Tcl.install(config)
15
+ end
16
+ rescue NoMethodError
17
+ # We are running outside of a Cucumber test run (e.g., in RSpec).
18
+ # Safely ignore the plugin registration.
19
+ end
20
+ def self.install(cucumber_config)
21
+ # Unless configured off, we should start up a new
22
+ # framework for each scenario, which results
23
+ # in a new TCL interpreter. This can be used
24
+ # to check that there is no data leakage between
25
+ # scenarios when testing poorly understood code
26
+ if ENV['SHARE_FRAMEWORK'] == '1'
27
+ framework = Framework.new(cucumber_config)
28
+ create_step_definitions = -> { StepDefinitions.new(framework) }
29
+ else
30
+ create_step_definitions = -> { StepDefinitions.new(Framework.new(cucumber_config)) }
31
+ end
32
+ cucumber_config.filters << ActivateSteps.new(create_step_definitions)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,29 @@
1
+ require_relative '../../../lib/cucumber/tcl'
2
+ require 'cucumber/core/test/case'
3
+ require 'cucumber/core/test/step'
4
+
5
+ module Cucumber
6
+ module Tcl
7
+ describe StepDefinitions do
8
+ let(:location) { double }
9
+ let(:test_step) do
10
+ multiline_arg = Cucumber::Core::Test::EmptyMultilineArgument.new
11
+ Cucumber::Core::Test::Step.new('step-id', 'Step name', location, multiline_arg)
12
+ end
13
+
14
+ it 'can activate a passing tcl step' do
15
+ path = "#{File.dirname(__FILE__)}/fixtures/everything_ok.tcl"
16
+ tcl_framework = Framework.new(nil, path)
17
+ step_definitions = described_class.new(tcl_framework)
18
+ expect(step_definitions.attempt_to_activate(test_step).location).to eq location
19
+ end
20
+
21
+ it 'raises a pending error when TCL returns a pending message' do
22
+ tcl_framework = double(step_definition_exists?: true, execute_step_definition: 'pending')
23
+ step_definitions = described_class.new(tcl_framework)
24
+ result = step_definitions.attempt_to_activate(test_step).execute
25
+ expect(result).to be_a Cucumber::Core::Test::Result::Pending
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ proc source_files { files } {
2
+ }
3
+
4
+ proc execute_step_definition { step_name } {
5
+ }
6
+
7
+ proc step_definition_exists { step_name } {
8
+ return 1
9
+ }
@@ -0,0 +1,29 @@
1
+ require_relative '../../../lib/cucumber/tcl'
2
+ require 'cucumber/core/test/case'
3
+ require 'cucumber/core/test/step'
4
+
5
+ module Cucumber
6
+ module Tcl
7
+ describe StepDefinitions do
8
+ let(:location) { double }
9
+ let(:test_step) do
10
+ multiline_arg = Cucumber::Core::Test::EmptyMultilineArgument.new
11
+ Cucumber::Core::Test::Step.new('step-id', 'Step name', location, multiline_arg)
12
+ end
13
+
14
+ it 'can activate a passing tcl step' do
15
+ path = "#{File.dirname(__FILE__)}/fixtures/everything_ok.tcl"
16
+ tcl_framework = Framework.new(nil, path)
17
+ step_definitions = described_class.new(tcl_framework)
18
+ expect(step_definitions.attempt_to_activate(test_step).location).to eq location
19
+ end
20
+
21
+ it 'raises a pending error when TCL returns a pending message' do
22
+ tcl_framework = double(step_definition_exists?: true, execute_step_definition: 'pending')
23
+ step_definitions = described_class.new(tcl_framework)
24
+ result = step_definitions.attempt_to_activate(test_step).execute
25
+ expect(result).to be_a Cucumber::Core::Test::Result::Pending
26
+ end
27
+ end
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yet-another-cucumber-tcl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.9
5
+ platform: ruby
6
+ authors:
7
+ - Matt Wynne
8
+ - Jon Owers
9
+ - Barney Fisher
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 1980-01-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: cucumber
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: yet-another-ruby-tcl
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.1.2
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.1.2
42
+ description: TCL plugin for Cucumber
43
+ email: pedro.miranda@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".rspec"
49
+ - ".rubocop.yml"
50
+ - CHANGELOG.md
51
+ - CONTRIBUTING.md
52
+ - Gemfile
53
+ - README.md
54
+ - Rakefile
55
+ - cucumber-tcl.gemspec
56
+ - cucumber.yml
57
+ - features/data_tables.feature
58
+ - features/define_a_step.feature
59
+ - features/doc_strings.feature
60
+ - features/file_sourcing.feature
61
+ - features/pending_step.feature
62
+ - features/reset_state.feature
63
+ - features/support/aruba.rb
64
+ - lib/cucumber/tcl.rb
65
+ - lib/cucumber/tcl/activate_steps.rb
66
+ - lib/cucumber/tcl/data_table.rb
67
+ - lib/cucumber/tcl/framework.rb
68
+ - lib/cucumber/tcl/framework.tcl
69
+ - lib/cucumber/tcl/step_definitions.rb
70
+ - lib/cucumber/tcl/test/test_framework.tcl
71
+ - lib/cucumber/tcl/version.rb
72
+ - spec/cucumber/tcl/data_table_spec.rb
73
+ - spec/cucumber/tcl/fixtures/everything_ok.tcl
74
+ - spec/cucumber/tcl/step_definitions_spec.rb
75
+ homepage: https://github.com/p3t3ru5/yet-another-cucumber-ruby-tcl#
76
+ licenses:
77
+ - MIT
78
+ metadata:
79
+ rubygems_mfa_required: 'true'
80
+ rdoc_options:
81
+ - "--charset=UTF-8"
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 3.0.0
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubygems_version: 4.0.15
96
+ specification_version: 4
97
+ summary: cucumber-tcl-0.0.9
98
+ test_files: []