cucumber-en_snippet 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/README.md +8 -0
- data/features/snippets.feature +2 -2
- data/features/support/env.rb +2 -2
- data/lib/cucumber/en_snippet.rb +25 -26
- data/lib/cucumber/en_snippet/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 895b0fcde0489036137e07ab852cb0e2a1ae18c1
|
4
|
+
data.tar.gz: acfa75b58269eb64686fb7c04cc99b63357ebc3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15f70247cbc350a06c96e124d26394264c3694b07769e9f93fa3c503ef9b52905add88ff216304ffc47b91b17ef7924edb3be1c290332f1c1ebf614f55283e8e
|
7
|
+
data.tar.gz: 83348c2f207ef5f21de155d4bb41d910709af28a87e923b0aae2d086ea7bd1a6f3132251d17b6f4921ebeb989e607db681e42ffac1f841184fb99645b8fb9996
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Cucumber::EnSnippet
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/mtsmfm/cucumber-en_snippet.png?branch=master)](https://travis-ci.org/mtsmfm/cucumber-en_snippet)
|
4
|
+
|
3
5
|
Output cucumber step definition snippets in English regardless of a language header.
|
4
6
|
|
5
7
|
## Installation
|
@@ -24,6 +26,12 @@ Require this library in your ruby files under `features/support`.
|
|
24
26
|
require 'cucumber/en_snippet'
|
25
27
|
```
|
26
28
|
|
29
|
+
Then, run cucumber with snippet type option `-I`.
|
30
|
+
|
31
|
+
```
|
32
|
+
bundle exec cucumber -I en_regexp
|
33
|
+
```
|
34
|
+
|
27
35
|
## Contributing
|
28
36
|
|
29
37
|
1. Fork it
|
data/features/snippets.feature
CHANGED
@@ -21,7 +21,7 @@ Feature: Snippets
|
|
21
21
|
example with <html> entities
|
22
22
|
\"\"\"
|
23
23
|
"""
|
24
|
-
When I run `cucumber features/undefined_steps.feature -s`
|
24
|
+
When I run `cucumber features/undefined_steps.feature -s -I en_regexp`
|
25
25
|
Then the output should contain:
|
26
26
|
"""
|
27
27
|
Given(/^a pystring$/) do |string|
|
@@ -39,7 +39,7 @@ Feature: Snippets
|
|
39
39
|
| table |
|
40
40
|
|example|
|
41
41
|
"""
|
42
|
-
When I run `cucumber features/undefined_steps.feature -s`
|
42
|
+
When I run `cucumber features/undefined_steps.feature -s -I en_regexp`
|
43
43
|
Then the output should contain:
|
44
44
|
"""
|
45
45
|
Given(/^a table$/) do |table|
|
data/features/support/env.rb
CHANGED
@@ -12,9 +12,9 @@ RSpec::Matchers.define :include do |expected|
|
|
12
12
|
failure_message_for_should do |actual|
|
13
13
|
<<-EOM.gsub(/^ *\|/, '')
|
14
14
|
|expected:
|
15
|
-
|
15
|
+
#{expected.gsub(/^/,'| ')}
|
16
16
|
|got:
|
17
|
-
|
17
|
+
#{actual.gsub(/^/,'| ')}
|
18
18
|
EOM
|
19
19
|
end
|
20
20
|
end
|
data/lib/cucumber/en_snippet.rb
CHANGED
@@ -1,35 +1,34 @@
|
|
1
1
|
require "cucumber/en_snippet/version"
|
2
2
|
|
3
|
-
require "cucumber/rb_support/snippet"
|
4
|
-
|
5
3
|
module Cucumber
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
class EnBaseSnippet < RbSupport::Snippet::BaseSnippet
|
5
|
+
def initialize(code_keyword, pattern, multiline_argument_class)
|
6
|
+
keyword = en_keyword(code_keyword)
|
7
|
+
keyword = code_keyword if keyword.empty?
|
10
8
|
|
11
|
-
|
12
|
-
|
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
|
9
|
+
super(keyword, pattern, multiline_argument_class)
|
10
|
+
end
|
26
11
|
|
27
|
-
|
28
|
-
end
|
12
|
+
private
|
29
13
|
|
30
|
-
|
31
|
-
|
32
|
-
|
14
|
+
def en_keyword(code_keyword)
|
15
|
+
%i(given when then).find {|k|
|
16
|
+
::Regexp.new(::Gherkin::I18n.keyword_regexp(k)) =~ code_keyword
|
17
|
+
}.to_s.capitalize
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class EnRegexp < EnBaseSnippet
|
22
|
+
def typed_pattern
|
23
|
+
"(/^#{pattern}$/)"
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.description
|
27
|
+
'Snippets with parentheses (English keywords)'
|
33
28
|
end
|
34
29
|
end
|
35
30
|
end
|
31
|
+
|
32
|
+
Cucumber::RbSupport::RbLanguage::SNIPPET_TYPES.merge!(
|
33
|
+
en_regexp: Cucumber::EnRegexp
|
34
|
+
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-en_snippet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fumiaki MATSUSHIMA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -89,6 +89,7 @@ extensions: []
|
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
91
|
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
92
93
|
- Gemfile
|
93
94
|
- LICENSE.txt
|
94
95
|
- README.md
|