cukesparse 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/cukesparse.rb +164 -164
- data/spec/test_cukesparse.rb +701 -0
- metadata +4 -4
- data/test/test_cukesparse.rb +0 -666
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZThkM2M0NzRmZTk1YWZmN2IxYjMxOTJlZDdjOWYzYjhiMzNkN2IzOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWMxMWQ3YTVhNTFlNmUzNTAzMjA1NDJkYzNjNGI2ZDM2OWVjNDQ4Mg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YWMwNjJiZWJmY2EyN2NkMTdmZDRmOTYwM2I5YmM2ODM2MTZjNjdjZWIzNjE4
|
10
|
+
YTg1NGU0NDBmZDE5YzBjM2UyMzJlOTVjNmMyYWQ2NjJkNjRkYzUwYzliMDUz
|
11
|
+
MzFmM2JkN2M3YTRiNGQ1ODQwY2UwMjgyMzg1MzgxYzg2YWNhODA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjM3ZTA3YTUzYWUwMTE1MjhhY2I1NTVlMTYwNWE3NjY0MzA2Njc1YTU2MzEz
|
14
|
+
NTZhMGMyMDJmYzBkYTE5NTM1YTQ0MTE0ZjRiNzFlZDVhOTllNjhiZTE5NjYz
|
15
|
+
ZmE2YTRkMjk4ZTVlYjkxMGM0OTllMWMxYWM3NTQ5MDJhZmFjYjA=
|
data/lib/cukesparse.rb
CHANGED
@@ -4,168 +4,168 @@ require 'colored'
|
|
4
4
|
|
5
5
|
class Cukesparse
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
7
|
+
attr_reader :parameters, :args
|
8
|
+
attr_accessor :config
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@config = load_config('config/tasks.yml')
|
12
|
+
@args = ARGV
|
13
|
+
@parameters = {}
|
14
|
+
@tasks = {}
|
15
|
+
@command = []
|
16
|
+
end
|
17
|
+
|
18
|
+
# Parses the options passed via command line
|
19
|
+
def parse_options
|
20
|
+
begin
|
21
|
+
cli @args,
|
22
|
+
# Cucumber options
|
23
|
+
'-t' => lambda{ |t| add_multiple(:tags, t) },
|
24
|
+
'-n --name' => lambda{ |n| @parameters[:name] = "--name #{n}" },
|
25
|
+
'-f --format' => ->(f){ @parameters[:format] = "--format #{f}" },
|
26
|
+
'-d --dry-run' => ->{ @parameters[:dry_run] = "--dry-run" },
|
27
|
+
'-v --verbose' => ->{ @parameters[:verbose] = "--verbose" },
|
28
|
+
'-s --strict' => ->{ @parameters[:strict] = "--strict" },
|
29
|
+
'-g --guess' => ->{ @parameters[:guess] = "--guess" },
|
30
|
+
'-x --expand' => ->{ @parameters[:expand] = "--expand" },
|
31
|
+
|
32
|
+
# All options below have been added for custom project but can be used for example
|
33
|
+
# Global options
|
34
|
+
'-e --environment' => ->(e){ @parameters[:environment] = "ENVIRONMENT=#{e}" },
|
35
|
+
'-l --loglevel' => ->(l){ @parameters[:log_level] = "LOG_LEVEL=#{l}" },
|
36
|
+
'-c --controller' => ->(c){ @parameters[:controller] = "CONTROLLER=#{c}" },
|
37
|
+
'-h --headless' => ->{ @parameters[:headless] = "HEADLESS=TRUE" },
|
38
|
+
|
39
|
+
# Database options
|
40
|
+
'--cleanup' => ->{ @parameters[:cleanup] = "CLEANUP=TRUE" },
|
41
|
+
'--no-cleanup' => ->{ @parameters[:cleanup] = "CLEANUP=FALSE" },
|
42
|
+
'--database' => ->{ @parameters[:database] = "DATABASE=TRUE" },
|
43
|
+
'--jenkins' => ->{ @parameters[:jenkins] = "JENKINS=TRUE" },
|
44
|
+
|
45
|
+
# Retry options
|
46
|
+
'--retries' => ->(r){ @parameters[:retries] = "RETRIES=#{r}" },
|
47
|
+
'--timeout' => ->(t){ @parameters[:timeout] = "TIMEOUT=#{t}" },
|
48
|
+
|
49
|
+
# Driver Options
|
50
|
+
'--screen' => ->(s){ split_parameters(s, :screen) },
|
51
|
+
'--position' => ->(p){ split_parameters(p, :position) },
|
52
|
+
'--screenwidth' => ->(w){ @parameters[:screen_width] = "SCREENWIDTH=#{w}" },
|
53
|
+
'--screenheight' => ->(h){ @parameters[:screen_height] = "SCREENHEIGHT=#{h}" },
|
54
|
+
'--xposition' => ->(x){ @parameters[:xposition] = "XPOSITION=#{x}" },
|
55
|
+
'--yposition' => ->(y){ @parameters[:yposition] = "YPOSITION=#{y}" },
|
56
|
+
'-H --highlight' => ->{ @parameters[:highlight] = "HIGHLIGHT=TRUE" },
|
57
|
+
|
58
|
+
# Debug
|
59
|
+
'--debug' => ->{ @parameters[:debug] = "DEBUG=TRUE" }
|
60
|
+
rescue
|
61
|
+
abort 'Error processing passed CLI arguments!'.red.underline
|
62
|
+
else
|
63
|
+
self
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Builds the command line string
|
68
|
+
def build_command
|
69
|
+
check_for_task
|
70
|
+
check_for_parameters
|
71
|
+
|
72
|
+
unless @task.empty? && @parameters.empty?
|
73
|
+
@command.push 'bundle exec cucumber'
|
74
|
+
@command.push '--require features/'
|
75
|
+
@command.push @task['feature_order'].join(' ')
|
76
|
+
@parameters.each { |k,v| @command.push(v) }
|
77
|
+
@command.push @task['defaults'].join(' ')
|
78
|
+
end
|
79
|
+
|
80
|
+
if @parameters.has_key? :debug
|
81
|
+
debug
|
82
|
+
else
|
83
|
+
system @command.join(' ')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# Outputs the debug information
|
88
|
+
def debug
|
89
|
+
puts 'DEBUG: Outputting ARGV passed'.yellow
|
90
|
+
puts @args.inspect
|
91
|
+
puts 'DEBUG: Outputting parameters created'.yellow
|
92
|
+
puts @parameters.inspect
|
93
|
+
puts 'DEBUG: Outputting command line created'.yellow
|
94
|
+
puts @command.join(' ')
|
95
|
+
end
|
96
|
+
|
97
|
+
# Loads the config file
|
98
|
+
#
|
99
|
+
# @param [String] file the location of tasks.yml
|
100
|
+
def load_config(file)
|
101
|
+
begin
|
102
|
+
return YAML.load_file(file)
|
103
|
+
rescue Psych::SyntaxError
|
104
|
+
abort 'Your tasks.yml did not parse as expected!'.red.underline
|
105
|
+
rescue Exception
|
106
|
+
abort 'Your tasks.yml file is missing!'.red.underline
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# Checks for task in arguments
|
111
|
+
def check_for_task
|
112
|
+
@task = @args & @config.keys
|
113
|
+
if @task.empty?
|
114
|
+
abort 'ERROR: No task was passed to cukesparse!'.red.underline
|
115
|
+
elsif @task.length > 1
|
116
|
+
abort 'ERROR: Multiple tasks have been passed!'.red.underline
|
117
|
+
else
|
118
|
+
@task = @config[@task[0]]
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Checks parameters and returns boolean
|
123
|
+
def check_for_parameters
|
124
|
+
unless @parameters.any?
|
125
|
+
puts 'WARN: No parameters passed to cukesparse'.yellow
|
126
|
+
end
|
127
|
+
|
128
|
+
set_runtime_defaults
|
129
|
+
end
|
130
|
+
|
131
|
+
# Updates parameters based on config runtime defaults
|
132
|
+
def set_runtime_defaults
|
133
|
+
if @task.has_key?('runtime_defaults')
|
134
|
+
@task['runtime_defaults'].each do |key, value|
|
135
|
+
unless @parameters.has_key? key.to_sym
|
136
|
+
@parameters[key.to_sym] = key.upcase + '=' + value.to_s
|
137
|
+
end
|
138
|
+
end
|
139
|
+
else
|
140
|
+
puts 'WARN: The task has no runtime defaults!'.yellow
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# Add multiple options to key
|
145
|
+
#
|
146
|
+
# @param [Symbol] key the key to store in options
|
147
|
+
# @param [String] the arguments passed in for key
|
148
|
+
def add_multiple(key, args)
|
149
|
+
(@parameters[key] ||= []).push('--' + key.to_s + ' ' + args)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Splits parameters passed
|
153
|
+
#
|
154
|
+
# @param [String] parameters the parameters passed
|
155
|
+
# @param [Symbol] sym the symbol passed
|
156
|
+
def split_parameters(parameters, sym)
|
157
|
+
parameters = parameters.split(',')
|
158
|
+
if parameters.length == 1
|
159
|
+
abort "ERROR: You have not passed enough parameters in the #{sym.to_s} command line argument!".red.underline
|
160
|
+
elsif parameters.length > 2
|
161
|
+
abort "ERROR: You have passed to many parameters in the #{sym.to_s} command line argument!".red.underline
|
162
|
+
end
|
163
|
+
|
164
|
+
case sym
|
165
|
+
when :screen
|
166
|
+
@parameters[sym] = "SCREENWIDTH=#{parameters[0]} SCREENHEIGHT=#{parameters[1]}"
|
167
|
+
when :position
|
168
|
+
@parameters[sym] = "XPOSITION=#{parameters[0]} YPOSITION=#{parameters[1]}"
|
169
|
+
end
|
170
|
+
end
|
171
171
|
end
|
@@ -0,0 +1,701 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
4
|
+
require 'cukesparse'
|
5
|
+
require 'colored'
|
6
|
+
require 'rspec'
|
7
|
+
|
8
|
+
describe "cukesparse" do
|
9
|
+
# Object
|
10
|
+
context "when new" do
|
11
|
+
before :all do
|
12
|
+
# Clear arguments as rspec passes in script path
|
13
|
+
ARGV = []
|
14
|
+
@cukesparse = Cukesparse.new
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should be an instance of cukesparse" do
|
18
|
+
@cukesparse.should be_an_instance_of Cukesparse
|
19
|
+
end
|
20
|
+
|
21
|
+
it "returns true for empty opts parameter" do
|
22
|
+
@cukesparse.parameters.should be_empty
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns true for empty args parameter" do
|
26
|
+
@cukesparse.args.should be_empty
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Parameters
|
31
|
+
context "when passed the -t parameter" do
|
32
|
+
before :all do
|
33
|
+
# Clear arguments as rspec passes in script path
|
34
|
+
ARGV = ['test_task', '-t', 'test']
|
35
|
+
@cukesparse = Cukesparse.new
|
36
|
+
@cukesparse.parse_options
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should have a parameter of tags" do
|
40
|
+
@cukesparse.parameters.should have_key :tags
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should have a tags parameter value of --tags test" do
|
44
|
+
@cukesparse.parameters[:tags].should eql ['--tags test']
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "when passed the -n parameter" do
|
49
|
+
before :all do
|
50
|
+
# Clear arguments as rspec passes in script path
|
51
|
+
ARGV = ['test_task', '-n', 'name_test']
|
52
|
+
@cukesparse = Cukesparse.new
|
53
|
+
@cukesparse.parse_options
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should have a parameter of name" do
|
57
|
+
@cukesparse.parameters.should have_key :name
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should have a name parameter value of test" do
|
61
|
+
@cukesparse.parameters[:name].should eql '--name name_test'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "when passed the -name parameter" do
|
66
|
+
before :all do
|
67
|
+
# Clear arguments as rspec passes in script path
|
68
|
+
ARGV = ['test_task', '--name', 'name_test']
|
69
|
+
@cukesparse = Cukesparse.new
|
70
|
+
@cukesparse.parse_options
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should have a parameter of name" do
|
74
|
+
@cukesparse.parameters.should have_key :name
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should have a name parameter value of test" do
|
78
|
+
@cukesparse.parameters[:name].should eql '--name name_test'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "when passed the -f parameter" do
|
83
|
+
before :all do
|
84
|
+
# Clear arguments as rspec passes in script path
|
85
|
+
ARGV = ['test_task', '-f', 'pretty']
|
86
|
+
@cukesparse = Cukesparse.new
|
87
|
+
@cukesparse.parse_options
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should have a parameter of format" do
|
91
|
+
@cukesparse.parameters.should have_key :format
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should have a tags parameter value of test" do
|
95
|
+
@cukesparse.parameters[:format].should eql '--format pretty'
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
context "when passed the --format parameter" do
|
100
|
+
before :all do
|
101
|
+
# Clear arguments as rspec passes in script path
|
102
|
+
ARGV = ['test_task', '--format', 'pretty']
|
103
|
+
@cukesparse = Cukesparse.new
|
104
|
+
@cukesparse.parse_options
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should have a parameter of format" do
|
108
|
+
@cukesparse.parameters.should have_key :format
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should have a tags parameter value of test" do
|
112
|
+
@cukesparse.parameters[:format].should eql '--format pretty'
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
context "when passed the -d parameter" do
|
117
|
+
before :all do
|
118
|
+
# Clear arguments as rspec passes in script path
|
119
|
+
ARGV = ['test_task', '-d']
|
120
|
+
@cukesparse = Cukesparse.new
|
121
|
+
@cukesparse.parse_options
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should have a parameter of name" do
|
125
|
+
@cukesparse.parameters.should have_key :dry_run
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should have a dry_run parameter value of --dry-run" do
|
129
|
+
@cukesparse.parameters[:dry_run].should eql '--dry-run'
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context "when passed the --dry-run parameter" do
|
134
|
+
before :all do
|
135
|
+
# Clear arguments as rspec passes in script path
|
136
|
+
ARGV = ['test_task', '--dry-run']
|
137
|
+
@cukesparse = Cukesparse.new
|
138
|
+
@cukesparse.parse_options
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should have a parameter of dry_run" do
|
142
|
+
@cukesparse.parameters.should have_key :dry_run
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should have a dry_run parameter value of --dry-run" do
|
146
|
+
@cukesparse.parameters[:dry_run].should eql '--dry-run'
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
context "when passed the -v parameter" do
|
151
|
+
before :all do
|
152
|
+
# Clear arguments as rspec passes in script path
|
153
|
+
ARGV = ['test_task', '-v']
|
154
|
+
@cukesparse = Cukesparse.new
|
155
|
+
@cukesparse.parse_options
|
156
|
+
end
|
157
|
+
|
158
|
+
it "should have a parameter of verbose" do
|
159
|
+
@cukesparse.parameters.should have_key :verbose
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should have a verbose parameter value of --verbose" do
|
163
|
+
@cukesparse.parameters[:verbose].should eql '--verbose'
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
context "when passed the --verbose parameter" do
|
168
|
+
before :all do
|
169
|
+
# Clear arguments as rspec passes in script path
|
170
|
+
ARGV = ['test_task', '--verbose']
|
171
|
+
@cukesparse = Cukesparse.new
|
172
|
+
@cukesparse.parse_options
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should have a parameter of verbose" do
|
176
|
+
@cukesparse.parameters.should have_key :verbose
|
177
|
+
end
|
178
|
+
|
179
|
+
it "should have a verbose parameter value of --verbose" do
|
180
|
+
@cukesparse.parameters[:verbose].should eql '--verbose'
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
context "when passed the -s parameter" do
|
185
|
+
before :all do
|
186
|
+
# Clear arguments as rspec passes in script path
|
187
|
+
ARGV = ['test_task', '-s']
|
188
|
+
@cukesparse = Cukesparse.new
|
189
|
+
@cukesparse.parse_options
|
190
|
+
end
|
191
|
+
|
192
|
+
it "should have a parameter of strict" do
|
193
|
+
@cukesparse.parameters.should have_key :strict
|
194
|
+
end
|
195
|
+
|
196
|
+
it "should have a strict parameter value of --strict" do
|
197
|
+
@cukesparse.parameters[:strict].should eql '--strict'
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
context "when passed the --strict parameter" do
|
202
|
+
before :all do
|
203
|
+
# Clear arguments as rspec passes in script path
|
204
|
+
ARGV = ['test_task', '-s']
|
205
|
+
@cukesparse = Cukesparse.new
|
206
|
+
@cukesparse.parse_options
|
207
|
+
end
|
208
|
+
|
209
|
+
it "should have a parameter of --strict" do
|
210
|
+
@cukesparse.parameters.should have_key :strict
|
211
|
+
end
|
212
|
+
|
213
|
+
it "should have a strict parameter value of --strict" do
|
214
|
+
@cukesparse.parameters[:strict].should eql '--strict'
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
context "when passed the -g parameter" do
|
219
|
+
before :all do
|
220
|
+
# Clear arguments as rspec passes in script path
|
221
|
+
ARGV = ['test_task', '-g']
|
222
|
+
@cukesparse = Cukesparse.new
|
223
|
+
@cukesparse.parse_options
|
224
|
+
end
|
225
|
+
|
226
|
+
it "should have a parameter of --guess" do
|
227
|
+
@cukesparse.parameters.should have_key :guess
|
228
|
+
end
|
229
|
+
|
230
|
+
it "should have a strict parameter value of --guess" do
|
231
|
+
@cukesparse.parameters[:guess].should eql '--guess'
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
context "when passed the --guess parameter" do
|
236
|
+
before :all do
|
237
|
+
# Clear arguments as rspec passes in script path
|
238
|
+
ARGV = ['test_task', '--guess']
|
239
|
+
@cukesparse = Cukesparse.new
|
240
|
+
@cukesparse.parse_options
|
241
|
+
end
|
242
|
+
|
243
|
+
it "should have a parameter of --guess" do
|
244
|
+
@cukesparse.parameters.should have_key :guess
|
245
|
+
end
|
246
|
+
|
247
|
+
it "should have a strict parameter value of --guess" do
|
248
|
+
@cukesparse.parameters[:guess].should eql '--guess'
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
context "when passed the -x parameter" do
|
253
|
+
before :all do
|
254
|
+
# Clear arguments as rspec passes in script path
|
255
|
+
ARGV = ['test_task', '-x']
|
256
|
+
@cukesparse = Cukesparse.new
|
257
|
+
@cukesparse.parse_options
|
258
|
+
end
|
259
|
+
|
260
|
+
it "should have a parameter of --expand" do
|
261
|
+
@cukesparse.parameters.should have_key :expand
|
262
|
+
end
|
263
|
+
|
264
|
+
it "should have a strict parameter value of --expand" do
|
265
|
+
@cukesparse.parameters[:expand].should eql '--expand'
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
context "when passed the --expand parameter" do
|
270
|
+
before :all do
|
271
|
+
# Clear arguments as rspec passes in script path
|
272
|
+
ARGV = ['test_task', '--expand']
|
273
|
+
@cukesparse = Cukesparse.new
|
274
|
+
@cukesparse.parse_options
|
275
|
+
end
|
276
|
+
|
277
|
+
it "should have a parameter of --expand" do
|
278
|
+
@cukesparse.parameters.should have_key :expand
|
279
|
+
end
|
280
|
+
|
281
|
+
it "should have a strict parameter value of --expand" do
|
282
|
+
@cukesparse.parameters[:expand].should eql '--expand'
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
context "when passed the -e parameter" do
|
287
|
+
before :all do
|
288
|
+
# Clear arguments as rspec passes in script path
|
289
|
+
ARGV = ['test_task', '-e', 'test_environment']
|
290
|
+
@cukesparse = Cukesparse.new
|
291
|
+
@cukesparse.parse_options
|
292
|
+
end
|
293
|
+
|
294
|
+
it "should have a parameter of environment" do
|
295
|
+
@cukesparse.parameters.should have_key :environment
|
296
|
+
end
|
297
|
+
|
298
|
+
it "should have a environment parameter value of ENVIRONMENT=test_environment" do
|
299
|
+
@cukesparse.parameters[:environment].should eql 'ENVIRONMENT=test_environment'
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
context "when passed the --environment parameter" do
|
304
|
+
before :all do
|
305
|
+
# Clear arguments as rspec passes in script path
|
306
|
+
ARGV = ['test_task', '--environment', 'test_environment']
|
307
|
+
@cukesparse = Cukesparse.new
|
308
|
+
@cukesparse.parse_options
|
309
|
+
end
|
310
|
+
|
311
|
+
it "should have a parameter of environment" do
|
312
|
+
@cukesparse.parameters.should have_key :environment
|
313
|
+
end
|
314
|
+
|
315
|
+
it "should have a environment parameter value of ENVIRONMENT=test_environment" do
|
316
|
+
@cukesparse.parameters[:environment].should eql 'ENVIRONMENT=test_environment'
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
context "when passed the -l parameter" do
|
321
|
+
before :all do
|
322
|
+
# Clear arguments as rspec passes in script path
|
323
|
+
ARGV = ['test_task', '-l', 'debug']
|
324
|
+
@cukesparse = Cukesparse.new
|
325
|
+
@cukesparse.parse_options
|
326
|
+
end
|
327
|
+
|
328
|
+
it "should have a parameter of loglevel" do
|
329
|
+
@cukesparse.parameters.should have_key :log_level
|
330
|
+
end
|
331
|
+
|
332
|
+
it "should have a loglevel parameter value of LOG_LEVEL=debug" do
|
333
|
+
@cukesparse.parameters[:log_level].should eql 'LOG_LEVEL=debug'
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
context "when passed the --loglevel parameter" do
|
338
|
+
before :all do
|
339
|
+
# Clear arguments as rspec passes in script path
|
340
|
+
ARGV = ['test_task', '--loglevel', 'debug']
|
341
|
+
@cukesparse = Cukesparse.new
|
342
|
+
@cukesparse.parse_options
|
343
|
+
end
|
344
|
+
|
345
|
+
it "should have a parameter of loglevel" do
|
346
|
+
@cukesparse.parameters.should have_key :log_level
|
347
|
+
end
|
348
|
+
|
349
|
+
it "should have a loglevel parameter value of LOG_LEVEL=debug" do
|
350
|
+
@cukesparse.parameters[:log_level].should eql 'LOG_LEVEL=debug'
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
context "when passed the -c parameter" do
|
355
|
+
before :all do
|
356
|
+
# Clear arguments as rspec passes in script path
|
357
|
+
ARGV = ['test_task', '-c', 'browser']
|
358
|
+
@cukesparse = Cukesparse.new
|
359
|
+
@cukesparse.parse_options
|
360
|
+
end
|
361
|
+
|
362
|
+
it "should have a parameter of controller" do
|
363
|
+
@cukesparse.parameters.should have_key :controller
|
364
|
+
end
|
365
|
+
|
366
|
+
it "should have a controller parameter value of CONTROLLER=browser" do
|
367
|
+
@cukesparse.parameters[:controller].should eql 'CONTROLLER=browser'
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
context "when passed the --controller parameter" do
|
372
|
+
before :all do
|
373
|
+
# Clear arguments as rspec passes in script path
|
374
|
+
ARGV = ['test_task', '--controller', 'browser']
|
375
|
+
@cukesparse = Cukesparse.new
|
376
|
+
@cukesparse.parse_options
|
377
|
+
end
|
378
|
+
|
379
|
+
it "should have a parameter of controller" do
|
380
|
+
@cukesparse.parameters.should have_key :controller
|
381
|
+
end
|
382
|
+
|
383
|
+
it "should have a controller parameter value of CONTROLLER=browser" do
|
384
|
+
@cukesparse.parameters[:controller].should eql 'CONTROLLER=browser'
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
context "when passed the -h parameter" do
|
389
|
+
before :all do
|
390
|
+
# Clear arguments as rspec passes in script path
|
391
|
+
ARGV = ['test_task', '-h']
|
392
|
+
@cukesparse = Cukesparse.new
|
393
|
+
@cukesparse.parse_options
|
394
|
+
end
|
395
|
+
|
396
|
+
it "should have a parameter of headless" do
|
397
|
+
@cukesparse.parameters.should have_key :headless
|
398
|
+
end
|
399
|
+
|
400
|
+
it "should have a headless parameter value of HEADLESS=TRUE" do
|
401
|
+
@cukesparse.parameters[:headless].should eql 'HEADLESS=TRUE'
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
context "when passed the --headless parameter" do
|
406
|
+
before :all do
|
407
|
+
# Clear arguments as rspec passes in script path
|
408
|
+
ARGV = ['test_task', '--headless']
|
409
|
+
@cukesparse = Cukesparse.new
|
410
|
+
@cukesparse.parse_options
|
411
|
+
end
|
412
|
+
|
413
|
+
it "should have a parameter of headless" do
|
414
|
+
@cukesparse.parameters.should have_key :headless
|
415
|
+
end
|
416
|
+
|
417
|
+
it "should have a headless parameter value of HEADLESS=TRUE" do
|
418
|
+
@cukesparse.parameters[:headless].should eql 'HEADLESS=TRUE'
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
context "when passed the --cleanup parameter" do
|
423
|
+
before :all do
|
424
|
+
# Clear arguments as rspec passes in script path
|
425
|
+
ARGV = ['test_task', '--cleanup']
|
426
|
+
@cukesparse = Cukesparse.new
|
427
|
+
@cukesparse.parse_options
|
428
|
+
end
|
429
|
+
|
430
|
+
it "should have a parameter of cleanup" do
|
431
|
+
@cukesparse.parameters.should have_key :cleanup
|
432
|
+
end
|
433
|
+
|
434
|
+
it "should have a cleanup parameter value of CLEANUP=TRUE" do
|
435
|
+
@cukesparse.parameters[:cleanup].should eql 'CLEANUP=TRUE'
|
436
|
+
end
|
437
|
+
end
|
438
|
+
|
439
|
+
context "when passed the --no-cleanup parameter" do
|
440
|
+
before :all do
|
441
|
+
# Clear arguments as rspec passes in script path
|
442
|
+
ARGV = ['test_task', '--no-cleanup']
|
443
|
+
@cukesparse = Cukesparse.new
|
444
|
+
@cukesparse.parse_options
|
445
|
+
end
|
446
|
+
|
447
|
+
it "should have a parameter of cleanup" do
|
448
|
+
@cukesparse.parameters.should have_key :cleanup
|
449
|
+
end
|
450
|
+
|
451
|
+
it "should have a cleanup parameter value of CLEANUP=FALSE" do
|
452
|
+
@cukesparse.parameters[:cleanup].should eql 'CLEANUP=FALSE'
|
453
|
+
end
|
454
|
+
end
|
455
|
+
|
456
|
+
context "when passed the --database parameter" do
|
457
|
+
before :all do
|
458
|
+
# Clear arguments as rspec passes in script path
|
459
|
+
ARGV = ['test_task', '--database']
|
460
|
+
@cukesparse = Cukesparse.new
|
461
|
+
@cukesparse.parse_options
|
462
|
+
end
|
463
|
+
|
464
|
+
it "should have a parameter of database" do
|
465
|
+
@cukesparse.parameters.should have_key :database
|
466
|
+
end
|
467
|
+
|
468
|
+
it "should have a database parameter value of DATABASE=TRUE" do
|
469
|
+
@cukesparse.parameters[:database].should eql 'DATABASE=TRUE'
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
context "when passed the --jenkins parameter" do
|
474
|
+
before :all do
|
475
|
+
# Clear arguments as rspec passes in script path
|
476
|
+
ARGV = ['test_task', '--jenkins']
|
477
|
+
@cukesparse = Cukesparse.new
|
478
|
+
@cukesparse.parse_options
|
479
|
+
end
|
480
|
+
|
481
|
+
it "should have a parameter of jenkins" do
|
482
|
+
@cukesparse.parameters.should have_key :jenkins
|
483
|
+
end
|
484
|
+
|
485
|
+
it "should have a jenkins parameter value of JENKINS=TRUE" do
|
486
|
+
@cukesparse.parameters[:jenkins].should eql 'JENKINS=TRUE'
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
490
|
+
context "when passed the --retries parameter" do
|
491
|
+
before :all do
|
492
|
+
# Clear arguments as rspec passes in script path
|
493
|
+
ARGV = ['test_task', '--retries', '5']
|
494
|
+
@cukesparse = Cukesparse.new
|
495
|
+
@cukesparse.parse_options
|
496
|
+
end
|
497
|
+
|
498
|
+
it "should have a parameter of retries" do
|
499
|
+
@cukesparse.parameters.should have_key :retries
|
500
|
+
end
|
501
|
+
|
502
|
+
it "should have a retries parameter value of RETRIES=5" do
|
503
|
+
@cukesparse.parameters[:retries].should eql 'RETRIES=5'
|
504
|
+
end
|
505
|
+
end
|
506
|
+
|
507
|
+
context "when passed the --timeout parameter" do
|
508
|
+
before :all do
|
509
|
+
# Clear arguments as rspec passes in script path
|
510
|
+
ARGV = ['test_task', '--timeout', '10']
|
511
|
+
@cukesparse = Cukesparse.new
|
512
|
+
@cukesparse.parse_options
|
513
|
+
end
|
514
|
+
|
515
|
+
it "should have a parameter of timeout" do
|
516
|
+
@cukesparse.parameters.should have_key :timeout
|
517
|
+
end
|
518
|
+
|
519
|
+
it "should have a timeout parameter value of TIMEOUT=10" do
|
520
|
+
@cukesparse.parameters[:timeout].should eql 'TIMEOUT=10'
|
521
|
+
end
|
522
|
+
end
|
523
|
+
|
524
|
+
context "when passed the --screen parameter" do
|
525
|
+
before :all do
|
526
|
+
# Clear arguments as rspec passes in script path
|
527
|
+
ARGV = ['test_task', '--screen', '1280,1024']
|
528
|
+
@cukesparse = Cukesparse.new
|
529
|
+
@cukesparse.parse_options
|
530
|
+
end
|
531
|
+
|
532
|
+
it "should have a parameter of screen" do
|
533
|
+
@cukesparse.parameters.should have_key :screen
|
534
|
+
end
|
535
|
+
|
536
|
+
it "should have a screen parameter value of SCREENWIDTH=1280 SCREENHEIGHT=1024" do
|
537
|
+
@cukesparse.parameters[:screen].should eql 'SCREENWIDTH=1280 SCREENHEIGHT=1024'
|
538
|
+
end
|
539
|
+
end
|
540
|
+
|
541
|
+
context "when passed the --position parameter" do
|
542
|
+
before :all do
|
543
|
+
# Clear arguments as rspec passes in script path
|
544
|
+
ARGV = ['test_task', '--position', '0,0']
|
545
|
+
@cukesparse = Cukesparse.new
|
546
|
+
@cukesparse.parse_options
|
547
|
+
end
|
548
|
+
|
549
|
+
it "should have a parameter of position" do
|
550
|
+
@cukesparse.parameters.should have_key :position
|
551
|
+
end
|
552
|
+
|
553
|
+
it "should have a position parameter value of XPOSITION=0 YPOSITION=0" do
|
554
|
+
@cukesparse.parameters[:position].should eql 'XPOSITION=0 YPOSITION=0'
|
555
|
+
end
|
556
|
+
end
|
557
|
+
|
558
|
+
context "when passed the --screenwidth parameter" do
|
559
|
+
before :all do
|
560
|
+
# Clear arguments as rspec passes in script path
|
561
|
+
ARGV = ['test_task', '--screenwidth', '1280']
|
562
|
+
@cukesparse = Cukesparse.new
|
563
|
+
@cukesparse.parse_options
|
564
|
+
end
|
565
|
+
|
566
|
+
it "should have a parameter of screenwidth" do
|
567
|
+
@cukesparse.parameters.should have_key :screen_width
|
568
|
+
end
|
569
|
+
|
570
|
+
it "should have a screenwidth parameter value of SCREENWIDTH=1280" do
|
571
|
+
@cukesparse.parameters[:screen_width].should eql 'SCREENWIDTH=1280'
|
572
|
+
end
|
573
|
+
end
|
574
|
+
|
575
|
+
context "when passed the --screenheight parameter" do
|
576
|
+
before :all do
|
577
|
+
# Clear arguments as rspec passes in script path
|
578
|
+
ARGV = ['test_task', '--screenheight', '1024']
|
579
|
+
@cukesparse = Cukesparse.new
|
580
|
+
@cukesparse.parse_options
|
581
|
+
end
|
582
|
+
|
583
|
+
it "should have a parameter of screenheight" do
|
584
|
+
@cukesparse.parameters.should have_key :screen_height
|
585
|
+
end
|
586
|
+
|
587
|
+
it "should have a screenheight parameter value of SCREENHEIGHT=1024" do
|
588
|
+
@cukesparse.parameters[:screen_height].should eql 'SCREENHEIGHT=1024'
|
589
|
+
end
|
590
|
+
end
|
591
|
+
|
592
|
+
context "when passed the --xposition parameter" do
|
593
|
+
before :all do
|
594
|
+
# Clear arguments as rspec passes in script path
|
595
|
+
ARGV = ['test_task', '--xposition', '100']
|
596
|
+
@cukesparse = Cukesparse.new
|
597
|
+
@cukesparse.parse_options
|
598
|
+
end
|
599
|
+
|
600
|
+
it "should have a parameter of xposition" do
|
601
|
+
@cukesparse.parameters.should have_key :xposition
|
602
|
+
end
|
603
|
+
|
604
|
+
it "should have a xposition parameter value of XPOSITION=100" do
|
605
|
+
@cukesparse.parameters[:xposition].should eql 'XPOSITION=100'
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
609
|
+
context "when passed the --yposition parameter" do
|
610
|
+
before :all do
|
611
|
+
# Clear arguments as rspec passes in script path
|
612
|
+
ARGV = ['test_task', '--yposition', '100']
|
613
|
+
@cukesparse = Cukesparse.new
|
614
|
+
@cukesparse.parse_options
|
615
|
+
end
|
616
|
+
|
617
|
+
it "should have a parameter of yposition" do
|
618
|
+
@cukesparse.parameters.should have_key :yposition
|
619
|
+
end
|
620
|
+
|
621
|
+
it "should have a yposition parameter value of YPOSITION=100" do
|
622
|
+
@cukesparse.parameters[:yposition].should eql 'YPOSITION=100'
|
623
|
+
end
|
624
|
+
end
|
625
|
+
|
626
|
+
context "when passed the -H parameter" do
|
627
|
+
before :all do
|
628
|
+
# Clear arguments as rspec passes in script path
|
629
|
+
ARGV = ['test_task', '-H']
|
630
|
+
@cukesparse = Cukesparse.new
|
631
|
+
@cukesparse.parse_options
|
632
|
+
end
|
633
|
+
|
634
|
+
it "should have a parameter of highlight" do
|
635
|
+
@cukesparse.parameters.should have_key :highlight
|
636
|
+
end
|
637
|
+
|
638
|
+
it "should have a highlight parameter value of HIGHLIGHT=TRUE" do
|
639
|
+
@cukesparse.parameters[:highlight].should eql 'HIGHLIGHT=TRUE'
|
640
|
+
end
|
641
|
+
end
|
642
|
+
|
643
|
+
context "when passed the --highlight parameter" do
|
644
|
+
before :all do
|
645
|
+
# Clear arguments as rspec passes in script path
|
646
|
+
ARGV = ['test_task', '--highlight']
|
647
|
+
@cukesparse = Cukesparse.new
|
648
|
+
@cukesparse.parse_options
|
649
|
+
end
|
650
|
+
|
651
|
+
it "should have a parameter of highlight" do
|
652
|
+
@cukesparse.parameters.should have_key :highlight
|
653
|
+
end
|
654
|
+
|
655
|
+
it "should have a highlight parameter value of HIGHLIGHT=TRUE" do
|
656
|
+
@cukesparse.parameters[:highlight].should eql 'HIGHLIGHT=TRUE'
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
660
|
+
context "when passed the --debug parameter" do
|
661
|
+
before :all do
|
662
|
+
# Clear arguments as rspec passes in script path
|
663
|
+
ARGV = ['test_task', '--debug']
|
664
|
+
@cukesparse = Cukesparse.new
|
665
|
+
@cukesparse.parse_options
|
666
|
+
end
|
667
|
+
|
668
|
+
it "should have a parameter of debug" do
|
669
|
+
@cukesparse.parameters.should have_key :debug
|
670
|
+
end
|
671
|
+
|
672
|
+
it "should have a debug parameter value of DEBUG=TRUE" do
|
673
|
+
@cukesparse.parameters[:debug].should eql 'DEBUG=TRUE'
|
674
|
+
end
|
675
|
+
end
|
676
|
+
|
677
|
+
# Default Parameters
|
678
|
+
context "when running the test task runtime default vars should be set when no arguments passed" do
|
679
|
+
before :all do
|
680
|
+
# Clear arguments as rspec passes in script path
|
681
|
+
# Adding test tag to prevent raise
|
682
|
+
ARGV = ['test_task', '-t', 'test']
|
683
|
+
@cukesparse = Cukesparse.new
|
684
|
+
@cukesparse.parse_options
|
685
|
+
@cukesparse.check_for_task
|
686
|
+
@cukesparse.check_for_parameters
|
687
|
+
end
|
688
|
+
|
689
|
+
it "should have runtime default parameters" do
|
690
|
+
@cukesparse.parameters.should have_key :environment
|
691
|
+
@cukesparse.parameters.should have_key :log_level
|
692
|
+
@cukesparse.parameters.should have_key :format
|
693
|
+
end
|
694
|
+
|
695
|
+
it "should have the expected default runtime parameter values" do
|
696
|
+
@cukesparse.parameters[:environment].should eql 'ENVIRONMENT=release'
|
697
|
+
@cukesparse.parameters[:log_level].should eql 'LOG_LEVEL=debug'
|
698
|
+
@cukesparse.parameters[:format].should eql 'FORMAT=pretty'
|
699
|
+
end
|
700
|
+
end
|
701
|
+
end
|