cucumber-en_snippet 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +1 -0
- data/cucumber-en_snippet.gemspec +27 -0
- data/features/snippets.feature +49 -0
- data/features/support/env.rb +20 -0
- data/lib/cucumber/en_snippet/version.rb +5 -0
- data/lib/cucumber/en_snippet.rb +35 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b6b5d7c5650abf5b320c37a78c8ad459f1741cd7
|
4
|
+
data.tar.gz: 9db778babaf1541e1a4a2bd7016a1db7e73bdffa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6ec4318d89f24b3d8ac824dfcf181a87c79fe955ca3d8428b18d5dc860b3af9401cc6f1fd617b14e9dad8edc986e0378cb474d0092527749ef0967c5d62b7eae
|
7
|
+
data.tar.gz: 61de5846c4fa0e44ce066422f82e6918d1273a92b68a01c307fa529566ac46f6c870b1cc46797cf7e9f70dee2b38474efe64fa999ed15109c277842b199a5f9f
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Fumiaki MATSUSHIMA
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Cucumber::EnSnippet
|
2
|
+
|
3
|
+
Output cucumber step definition snippets in English regardless of a language header.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'cucumber-en_snippet'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install cucumber-en_snippet
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Require this library in your ruby files under `features/support`.
|
22
|
+
|
23
|
+
``` ruby
|
24
|
+
require 'cucumber/en_snippet'
|
25
|
+
```
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
1. Fork it
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cucumber/en_snippet/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cucumber-en_snippet"
|
8
|
+
spec.version = Cucumber::EnSnippet::VERSION
|
9
|
+
spec.authors = ["Fumiaki MATSUSHIMA"]
|
10
|
+
spec.email = ["mtsmfm@gmail.com"]
|
11
|
+
spec.description = "Output cucumber step definition snippets in English regardless of a language header"
|
12
|
+
spec.summary = "Output cucumber snippets in English"
|
13
|
+
spec.homepage = "https://github.com/mtsmfm/cucumber-en_snippet"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'cucumber'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "aruba"
|
26
|
+
spec.add_development_dependency "pry"
|
27
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Feature: Snippets
|
2
|
+
|
3
|
+
Cucumber helpfully prints out any undefined step definitions as a code
|
4
|
+
snippet suggestion, which you can then paste into a step definitions
|
5
|
+
file of your choosing.
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given a file named "features/support/env.rb" with:
|
9
|
+
"""
|
10
|
+
require 'cucumber/en_snippet'
|
11
|
+
"""
|
12
|
+
|
13
|
+
Scenario: Snippet for undefined step with a pystring
|
14
|
+
Given a file named "features/undefined_steps.feature" with:
|
15
|
+
"""
|
16
|
+
# language: ja
|
17
|
+
フィーチャ:
|
18
|
+
シナリオ: pystring
|
19
|
+
前提 a pystring
|
20
|
+
\"\"\"
|
21
|
+
example with <html> entities
|
22
|
+
\"\"\"
|
23
|
+
"""
|
24
|
+
When I run `cucumber features/undefined_steps.feature -s`
|
25
|
+
Then the output should contain:
|
26
|
+
"""
|
27
|
+
Given(/^a pystring$/) do |string|
|
28
|
+
pending # express the regexp above with the code you wish you had
|
29
|
+
end
|
30
|
+
"""
|
31
|
+
|
32
|
+
Scenario: Snippet for undefined step with a step table
|
33
|
+
Given a file named "features/undefined_steps.feature" with:
|
34
|
+
"""
|
35
|
+
# language: ja
|
36
|
+
フィーチャ:
|
37
|
+
シナリオ: table
|
38
|
+
前提 a table
|
39
|
+
| table |
|
40
|
+
|example|
|
41
|
+
"""
|
42
|
+
When I run `cucumber features/undefined_steps.feature -s`
|
43
|
+
Then the output should contain:
|
44
|
+
"""
|
45
|
+
Given(/^a table$/) do |table|
|
46
|
+
# table is a Cucumber::Ast::Table
|
47
|
+
pending # express the regexp above with the code you wish you had
|
48
|
+
end
|
49
|
+
"""
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
require 'pry'
|
3
|
+
require 'cucumber/en_snippet'
|
4
|
+
|
5
|
+
require 'rspec/expectations'
|
6
|
+
|
7
|
+
RSpec::Matchers.define :include do |expected|
|
8
|
+
match do |actual|
|
9
|
+
actual.include? expected
|
10
|
+
end
|
11
|
+
|
12
|
+
failure_message_for_should do |actual|
|
13
|
+
<<-EOM.gsub(/^ *\|/, '')
|
14
|
+
|expected:
|
15
|
+
|#{expected.gsub(/^/,' ')}
|
16
|
+
|got:
|
17
|
+
|#{actual.gsub(/^/,' ')}
|
18
|
+
EOM
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "cucumber/en_snippet/version"
|
2
|
+
|
3
|
+
require "cucumber/rb_support/snippet"
|
4
|
+
|
5
|
+
module Cucumber
|
6
|
+
module EnSnippet
|
7
|
+
# Your code goes here...
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module Cucumber
|
12
|
+
module RbSupport
|
13
|
+
module Snippet
|
14
|
+
class BaseSnippet
|
15
|
+
def initialize_with_en_keyword(code_keyword, pattern, multiline_argument_class)
|
16
|
+
case
|
17
|
+
when ::Regexp.new(Gherkin::I18n.keyword_regexp(:given)) =~ code_keyword
|
18
|
+
en_keyword = 'Given'
|
19
|
+
when ::Regexp.new(Gherkin::I18n.keyword_regexp(:when)) =~ code_keyword
|
20
|
+
en_keyword = 'When'
|
21
|
+
when ::Regexp.new(Gherkin::I18n.keyword_regexp(:then)) =~ code_keyword
|
22
|
+
en_keyword = 'Then'
|
23
|
+
else
|
24
|
+
en_keyword = code_keyword
|
25
|
+
end
|
26
|
+
|
27
|
+
initialize_without_en_keyword(en_keyword, pattern, multiline_argument_class)
|
28
|
+
end
|
29
|
+
|
30
|
+
alias_method :initialize_without_en_keyword, :initialize
|
31
|
+
alias_method :initialize, :initialize_with_en_keyword
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cucumber-en_snippet
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fumiaki MATSUSHIMA
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cucumber
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aruba
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Output cucumber step definition snippets in English regardless of a language
|
84
|
+
header
|
85
|
+
email:
|
86
|
+
- mtsmfm@gmail.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- cucumber-en_snippet.gemspec
|
97
|
+
- features/snippets.feature
|
98
|
+
- features/support/env.rb
|
99
|
+
- lib/cucumber/en_snippet.rb
|
100
|
+
- lib/cucumber/en_snippet/version.rb
|
101
|
+
homepage: https://github.com/mtsmfm/cucumber-en_snippet
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.2.0
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: Output cucumber snippets in English
|
125
|
+
test_files:
|
126
|
+
- features/snippets.feature
|
127
|
+
- features/support/env.rb
|