cucumber-tcl 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 84ec39aecfb982b06d4ba5ebb5700f0a40e97018
4
+ data.tar.gz: 1833986ac0f590191f935850f7ebdaf94fe78e98
5
+ SHA512:
6
+ metadata.gz: 4eab85f4429224ff463a142913ca64999173889ecb0f5e1cfdbbb4d8e81ab6edadcbec561435d51cfca2b65ba1d17c6f9a30dc58af487e68d3cc6a97330de76f
7
+ data.tar.gz: 8c9011e35f8a38800421482f9d3fcb97c92190a0281fa7835584414ac947491db54e2906f8cb041de22f8011f5ab7e69b41dac1f047cad5a138ed9ccd1f79987
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+ gemspec
3
+
4
+ # hack
5
+ gem "cucumber", path: "../cucumber"
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ Cucumber TCL Bindings
2
+ =====================
3
+
4
+ Define Cucumber steps using TCL code.
5
+
6
+ How to use
7
+ ----------
8
+
9
+ First, add the project to your Gemfile:
10
+
11
+ gem 'cucumber-tcl'
12
+
13
+ Install it:
14
+
15
+ bundle install
16
+
17
+ In a file in Cucumber's load path, like `features/support/env.rb`, add the following line:
18
+
19
+ require 'cucumber/tcl'
20
+
21
+ Finally, add a TCL entry point, at `features/support/env.tcl`.
22
+
23
+ Your TCL program must implement two procs: `step_definition_exists` and `execute_step_definition`. For example:
24
+
25
+ proc step_definition_exists {step_name} {
26
+ return 1
27
+ }
28
+
29
+ proc execute_step_definition {step_name} {
30
+ puts "Hello world"
31
+ }
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+ require 'rubygems'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ task default: [:cucumber]
7
+
8
+ task :cucumber do
9
+ sh "cucumber -f pretty"
10
+ end
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'cucumber-tcl'
6
+ s.version = File.read('lib/cucumber/tcl/version')
7
+ s.authors = ["Matt Wynne", "Jon Owers", "Barney Fisher"]
8
+ s.description = "TCL plugin for Cucumber"
9
+ s.summary = "cucumber-tcl-#{s.version}"
10
+ s.email = 'cukes@googlegroups.com'
11
+ s.license = 'MIT'
12
+ s.homepage = "https://github.com/cucumber/cucumber-ruby-tcl"
13
+ s.platform = Gem::Platform::RUBY
14
+ s.required_ruby_version = ">= 1.9.3"
15
+
16
+ s.add_dependency 'ruby-tcl'
17
+ s.add_dependency 'cucumber-core'
18
+
19
+ s.add_development_dependency 'cucumber', '~> 2.0.0.rc.4'
20
+ s.add_development_dependency 'rspec', '~> 3.2'
21
+ s.add_development_dependency 'aruba', '~> 0.6'
22
+ s.add_development_dependency 'yard', '~> 0.8'
23
+ s.add_development_dependency 'rake', '~> 10.0'
24
+
25
+ s.rubygems_version = ">= 1.6.1"
26
+ s.files = `git ls-files`.split("\n").reject {|path| path =~ /\.gitignore$/ }
27
+ s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
28
+ s.rdoc_options = ["--charset=UTF-8"]
29
+ s.require_path = "lib"
30
+ end
@@ -0,0 +1,28 @@
1
+ Feature: Define a step
2
+
3
+ Scenario: Define a passing step
4
+ Given a file named "features/test.feature" with:
5
+ """
6
+ Feature:
7
+ Scenario:
8
+ Given passing
9
+ """
10
+ And a file named "features/support/env.rb" with:
11
+ """
12
+ require 'cucumber/tcl'
13
+ """
14
+ And a file named "features/support/env.tcl" with:
15
+ """
16
+ proc step_definition_exists {step_name} {
17
+ return 1
18
+ }
19
+
20
+ proc execute_step_definition {step_name} {
21
+ puts "Hello world"
22
+ }
23
+ """
24
+ When I run `cucumber`
25
+ Then it should pass with:
26
+ """
27
+ Hello world
28
+ """
@@ -0,0 +1 @@
1
+ require 'aruba/cucumber'
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,44 @@
1
+ require 'cucumber/core/filter'
2
+
3
+ module Cucumber
4
+ module Tcl
5
+ ActivateSteps = Cucumber::Core::Filter.new(:step_definitions) do
6
+ def test_case(test_case)
7
+ activated_steps = test_case.test_steps.map do |test_step|
8
+ attempt_to_activate(test_step)
9
+ end
10
+ test_case.with_steps(activated_steps).describe_to receiver
11
+ end
12
+
13
+ private
14
+
15
+ def attempt_to_activate(test_step)
16
+ return test_step unless step_definitions.match?(test_step.name)
17
+ test_step.with_action &step_definitions.action_for(test_step.name)
18
+ end
19
+ end
20
+
21
+ require 'tcl'
22
+ class StepDefinitions
23
+ def initialize(path)
24
+ raise ArgumentError, "cucumber-tcl entry point #{path} does not exist." unless File.exists?(path)
25
+ @tcl = ::Tcl::Interp.load_from_file(path)
26
+ end
27
+
28
+ def match?(step_name)
29
+ @tcl.proc('step_definition_exists').call(step_name) == "1"
30
+ end
31
+
32
+ def action_for(step_name)
33
+ proc { @tcl.proc('execute_step_definition').call(step_name) }
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ if respond_to?(:AfterConfiguration)
40
+ AfterConfiguration do |config|
41
+ step_definitions = Cucumber::Tcl::StepDefinitions.new('features/support/env.tcl')
42
+ config.filters << Cucumber::Tcl::ActivateSteps.new(step_definitions)
43
+ end
44
+ end
@@ -0,0 +1,10 @@
1
+ require 'cucumber/tcl'
2
+
3
+ module Cucumber::Tcl
4
+ describe StepDefinitions do
5
+ it "can query for a step definition" do
6
+ step_definitions = StepDefinitions.new(File.dirname(__FILE__) + '/steps.tcl')
7
+ expect(step_definitions.match?('passing')).to be_truthy
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ proc step_definition_exists { step_name } {
2
+ return 1
3
+ }
metadata ADDED
@@ -0,0 +1,160 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cucumber-tcl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Matt Wynne
8
+ - Jon Owers
9
+ - Barney Fisher
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2015-02-06 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: ruby-tcl
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
29
+ - !ruby/object:Gem::Dependency
30
+ name: cucumber-core
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: cucumber
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: 2.0.0.rc.4
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: 2.0.0.rc.4
57
+ - !ruby/object:Gem::Dependency
58
+ name: rspec
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '3.2'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: '3.2'
71
+ - !ruby/object:Gem::Dependency
72
+ name: aruba
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '0.6'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: '0.6'
85
+ - !ruby/object:Gem::Dependency
86
+ name: yard
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '0.8'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - "~>"
97
+ - !ruby/object:Gem::Version
98
+ version: '0.8'
99
+ - !ruby/object:Gem::Dependency
100
+ name: rake
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: '10.0'
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: '10.0'
113
+ description: TCL plugin for Cucumber
114
+ email: cukes@googlegroups.com
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".rspec"
120
+ - Gemfile
121
+ - README.md
122
+ - Rakefile
123
+ - cucumber-tcl.gemspec
124
+ - features/define_a_step.feature
125
+ - features/support/aruba.rb
126
+ - lib/cucumber/tcl.rb
127
+ - lib/cucumber/tcl/version
128
+ - spec/cucumber/tcl/step_definitions_spec.rb
129
+ - spec/cucumber/tcl/steps.tcl
130
+ homepage: https://github.com/cucumber/cucumber-ruby-tcl
131
+ licenses:
132
+ - MIT
133
+ metadata: {}
134
+ post_install_message:
135
+ rdoc_options:
136
+ - "--charset=UTF-8"
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: 1.9.3
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 2.2.2
152
+ signing_key:
153
+ specification_version: 4
154
+ summary: cucumber-tcl-0.0.1
155
+ test_files:
156
+ - features/define_a_step.feature
157
+ - features/support/aruba.rb
158
+ - spec/cucumber/tcl/step_definitions_spec.rb
159
+ - spec/cucumber/tcl/steps.tcl
160
+ has_rdoc: