cukecutter 0.0.2 → 0.0.3
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 +4 -4
- data/lib/cukecutter.rb +26 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9811f254137cf84f1c5b22c6805b228a9c62eed
|
4
|
+
data.tar.gz: c2c625f55ea5e22e553fc9cb1f41d41216ac8afa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abcf23e2ba30b5e9798b6e4e3fedb05c217d942a539c6e1100dfa0538c843ea80c0be8dd75ce9506f52758700e3913ca64540174115f02bb7dbf7006b88c1663
|
7
|
+
data.tar.gz: d1174624605e05c90634476358bd0a365808a30bbcc7603b1315c5e59d2c11ff3a202a6c84abb25e48e39aa459bd84ccbe96e47f0d9e06a919fcd77347c41977
|
data/lib/cukecutter.rb
CHANGED
@@ -7,19 +7,22 @@ require 'fileutils'
|
|
7
7
|
# cukecutter.steps
|
8
8
|
# cukecutter.write_feature
|
9
9
|
# cukecutter.cucumber_wrapper
|
10
|
+
|
10
11
|
class Cukecutter
|
11
12
|
|
12
13
|
def feature(feature, scenario)
|
13
14
|
@feature = feature
|
14
15
|
@scenario = scenario
|
16
|
+
@tags = tags
|
17
|
+
@description = description
|
15
18
|
end
|
16
19
|
|
17
20
|
# Creates the following folders
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
+
# features/
|
22
|
+
# features/step_definitions
|
23
|
+
# features/support
|
21
24
|
# And the file
|
22
|
-
#
|
25
|
+
# features/support/env.rb
|
23
26
|
def create_structure
|
24
27
|
if File.exists?("features") && File.directory?("features")
|
25
28
|
return
|
@@ -46,6 +49,10 @@ class Cukecutter
|
|
46
49
|
def create_feature
|
47
50
|
print "Feature name: "
|
48
51
|
@feature = gets.chomp
|
52
|
+
print "Feature description: "
|
53
|
+
@description = gets.chomp
|
54
|
+
print "Tags seperated by spaces (ex: @api):"
|
55
|
+
@tags = gets.chomp
|
49
56
|
print "Scenario: "
|
50
57
|
@scenario = gets.chomp
|
51
58
|
puts "please enter steps:"
|
@@ -54,16 +61,18 @@ class Cukecutter
|
|
54
61
|
|
55
62
|
# Creates .feature and .steps.rb files
|
56
63
|
def write_feature
|
57
|
-
File.open("features/""#{@feature}.feature", "w") do |f|
|
64
|
+
File.open("features/""#{@feature.gsub(" ", "_")}.feature", "w") do |f|
|
65
|
+
f.write("#{@tags}\n")
|
58
66
|
f.write("Feature: #{@feature}\n")
|
67
|
+
f.write("Description: #{@description}\n\n")
|
59
68
|
f.write("\tScenario: #{@scenario}\n")
|
60
69
|
end
|
61
70
|
@steps.each do |steps|
|
62
|
-
File.open("features/""#{@feature}.feature", "a") do |f|
|
71
|
+
File.open("features/""#{@feature.gsub(" ", "_")}.feature", "a") do |f|
|
63
72
|
f.write("\t\t#{steps}")
|
64
73
|
end
|
65
74
|
end
|
66
|
-
FileUtils.touch "features/step_definitions/#{@feature}.steps.rb"
|
75
|
+
FileUtils.touch "features/step_definitions/#{@feature.gsub(" ", "_")}.steps.rb"
|
67
76
|
end
|
68
77
|
|
69
78
|
|
@@ -97,9 +106,16 @@ class Cukecutter
|
|
97
106
|
|
98
107
|
# runs cucumber and generates contents of .step_definitions from cucumber output
|
99
108
|
def cucumber_wrapper
|
100
|
-
cucumber = `cucumber features/#{@feature}.feature`
|
101
|
-
File.open("features/step_definitions/#{@feature}.steps.rb", 'w') do |parsed_steps|
|
109
|
+
cucumber = `cucumber features/#{@feature.gsub(" ", "_")}.feature`
|
110
|
+
File.open("features/step_definitions/#{@feature.gsub(" ", "_")}.steps.rb", 'w') do |parsed_steps|
|
102
111
|
parsed_steps.write cucumber.split("You can implement step definitions for undefined steps with these snippets:\n\n").last
|
103
112
|
end
|
104
113
|
end
|
105
|
-
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# cukecutter = Cukecutter.new
|
117
|
+
# cukecutter.create_structure
|
118
|
+
# cukecutter.create_feature
|
119
|
+
# cukecutter.steps
|
120
|
+
# cukecutter.write_feature
|
121
|
+
# cukecutter.cucumber_wrapper
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cukecutter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Walker
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
description: Cucumber feature and step definition tool
|
27
|
+
description: Cucumber feature and step definition tool automated generator
|
28
28
|
email: adamlwalker77@gmail.com
|
29
29
|
executables: []
|
30
30
|
extensions: []
|