cukesparse 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/LICENCE.md +20 -0
- data/README.md +2 -1
- data/cukesparse.gemspec +1 -1
- data/lib/cukesparse.rb +9 -2
- data/lib/cukesparse/version.rb +1 -1
- data/spec/cukesparse/add_multiple_spec.rb +24 -0
- data/spec/cukesparse/check_for_parameters_spec.rb +16 -0
- data/spec/cukesparse/check_for_task_spec.rb +37 -0
- data/spec/cukesparse/execute_spec.rb +24 -0
- data/spec/cukesparse/load_config_spec.rb +24 -0
- data/spec/cukesparse/parse_argv_spec.rb +603 -0
- data/spec/cukesparse/set_cucumber_defaults_spec.rb +53 -0
- data/spec/cukesparse/set_runtime_defaults_spec.rb +62 -0
- data/spec/cukesparse/split_parameters_spec.rb +42 -0
- data/spec/cukesparse_spec.rb +3 -920
- data/spec/{spec_files → fixtures}/invalid_tasks.yml +0 -0
- data/spec/{spec_files → fixtures}/valid_tasks.yml +0 -0
- data/spec/helper.rb +12 -0
- metadata +27 -7
- data/config/tasks.yml +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c90d215f8fb5a25a8ac4d3118c9f5fa051cb82a
|
4
|
+
data.tar.gz: 3859761458f24dac7158f86e8c1dfdfee201227a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc10ea17d2ee538d8471837fad7aa77842f9733abcd8de6241328b557236b43fe85d740ac146730618d7699670ff67b6f48bc2ceca7d93ec7e31f167d90dd927
|
7
|
+
data.tar.gz: 34781891aa0413c0b4148c2cb9d6289e6d39413a9399f658443823eed6be423d603c729fc92cde7014cebb01a5f37ba08ed6fe4942d596eca81976e94d6c76ae
|
data/.travis.yml
CHANGED
data/LICENCE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Jonathan Chrisp
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/cukesparse.png)](http://badge.fury.io/rb/cukesparse)
|
1
2
|
[![Build Status](https://travis-ci.org/jonathanchrisp/cukesparse.png?branch=master)](https://travis-ci.org/jonathanchrisp/cukesparse)
|
2
3
|
[![Dependency Status](https://gemnasium.com/jonathanchrisp/cukesparse.png)](https://gemnasium.com/jonathanchrisp/cukesparse)
|
3
4
|
[![Coverage Status](https://coveralls.io/repos/jonathanchrisp/cukesparse/badge.png?branch=master)](https://coveralls.io/r/jonathanchrisp/cukesparse)
|
@@ -141,7 +142,7 @@ You would get the following returned in the console:
|
|
141
142
|
## Tests
|
142
143
|
There are a number of unit tests which are included as part of this project which are run by rspec. Please run:
|
143
144
|
|
144
|
-
rspec spec/
|
145
|
+
rspec spec/
|
145
146
|
|
146
147
|
## Feedback
|
147
148
|
I would be more than happy to recieve feedback, please email me at: jonathan.chrisp@gmail.com
|
data/cukesparse.gemspec
CHANGED
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + "/lib/cukesparse/version"
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'cukesparse'
|
5
5
|
s.version = Cukesparse::VERSION
|
6
|
-
s.date = '2013-08-
|
6
|
+
s.date = '2013-08-27'
|
7
7
|
s.summary = 'Cukesparse - cucumber command line parser'
|
8
8
|
s.description = 'A simple command line parser to pass arguments into Cucumber'
|
9
9
|
s.author = 'Jonathan Chrisp'
|
data/lib/cukesparse.rb
CHANGED
@@ -60,9 +60,9 @@ module Cukesparse
|
|
60
60
|
unless @task.empty? && @parameters.empty?
|
61
61
|
@command.push 'bundle exec cucumber'
|
62
62
|
@command.push '--require features/'
|
63
|
-
@command.push task['feature_order'].join(' ')
|
63
|
+
@command.push task['feature_order'].join(' ') if task.has_key? 'feature_order'
|
64
64
|
@parameters.each { |k,v| @command.push(v) }
|
65
|
-
@command.push task['defaults'].join(' ')
|
65
|
+
@command.push task['defaults'].join(' ') if task.has_key? 'defaults'
|
66
66
|
end
|
67
67
|
|
68
68
|
if @parameters.has_key? :debug
|
@@ -232,6 +232,13 @@ module Cukesparse
|
|
232
232
|
@parameters[:yposition] = "YPOSITION=#{params[1]}"
|
233
233
|
end
|
234
234
|
end
|
235
|
+
|
236
|
+
def reset!
|
237
|
+
@config = nil
|
238
|
+
@parameters = {}
|
239
|
+
@task = {}
|
240
|
+
@command = []
|
241
|
+
end
|
235
242
|
end
|
236
243
|
|
237
244
|
# defaults
|
data/lib/cukesparse/version.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe '.add_multiple' do
|
4
|
+
before :each do
|
5
|
+
ARGV.clear
|
6
|
+
Cukesparse.reset!
|
7
|
+
end
|
8
|
+
|
9
|
+
context "when run with a single value" do
|
10
|
+
it "will add a key to parameters with the correct array value" do
|
11
|
+
Cukesparse.add_multiple(:tags, 'abc')
|
12
|
+
Cukesparse.parameters.should have_key(:tags)
|
13
|
+
Cukesparse.parameters[:tags].should eql ['--tags abc']
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "when run with multiple values" do
|
18
|
+
it "will add a key to parameters with the correct array values" do
|
19
|
+
Cukesparse.add_multiple(:tags, ['abc', 'def', 'hij'])
|
20
|
+
Cukesparse.parameters.should have_key(:tags)
|
21
|
+
Cukesparse.parameters[:tags].should eql ['--tags abc', '--tags def', '--tags hij']
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe '.check_for_parameters' do
|
4
|
+
before :each do
|
5
|
+
ARGV.clear
|
6
|
+
Cukesparse.reset!
|
7
|
+
end
|
8
|
+
|
9
|
+
context "when run with no paramaters defined" do
|
10
|
+
it "will return an warning if no parameters are provided" do
|
11
|
+
Cukesparse.instance_variable_set(:@parameters, {})
|
12
|
+
Cukesparse.should_receive("puts").with("\e[0;33;49mWARN: No parameters passed to cukesparse\e[0m")
|
13
|
+
Cukesparse.check_for_parameters
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe '.check_for_task' do
|
4
|
+
before :each do
|
5
|
+
ARGV.clear
|
6
|
+
Cukesparse.reset!
|
7
|
+
end
|
8
|
+
|
9
|
+
context "when run with no task defined" do
|
10
|
+
it "will return an error if no task is provided" do
|
11
|
+
ARGV.push('incorrect_task')
|
12
|
+
Cukesparse.config = {}
|
13
|
+
Cukesparse.should_receive("abort").with("\e[4;31;49mERROR: No task was passed to cukesparse!\e[0m")
|
14
|
+
Cukesparse.check_for_task
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "when run with multiple tasks defined" do
|
19
|
+
it "will return an error if multiple tasks are provided" do
|
20
|
+
ARGV.push('test_task', 'test_task1')
|
21
|
+
Cukesparse.configure {|c| c.config_file = File.join(fixture_path, 'valid_tasks.yml')}
|
22
|
+
Cukesparse.load_config
|
23
|
+
Cukesparse.should_receive("puts").with("\e[0;33;49mWARN: Multiple tasks have been passed!\e[0m")
|
24
|
+
Cukesparse.check_for_task
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "when task is defined the @task instance variable will return a hash" do
|
29
|
+
it "will set the task in @task" do
|
30
|
+
ARGV.push('test_task')
|
31
|
+
Cukesparse.configure {|c| c.config_file = File.join(fixture_path, 'valid_tasks.yml')}
|
32
|
+
Cukesparse.load_config
|
33
|
+
Cukesparse.check_for_task
|
34
|
+
Cukesparse.task.should be_an_instance_of Hash
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe '.execute' do
|
4
|
+
before :each do
|
5
|
+
ARGV.clear
|
6
|
+
Cukesparse.reset!
|
7
|
+
end
|
8
|
+
|
9
|
+
context "when run with no arguments" do
|
10
|
+
it "should display a cukesparse information message" do
|
11
|
+
Cukesparse.should_receive("puts").with("\e[0;33;49mCukesparse - a simple command line parser to pass arguments into Cucumber!\e[0m")
|
12
|
+
Cukesparse.execute
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "when run with the tasks argument" do
|
17
|
+
it "should display the tasks within the config file" do
|
18
|
+
Cukesparse.configure {|c| c.config_file = File.join(fixture_path, 'valid_tasks.yml')}
|
19
|
+
ARGV.push('tasks')
|
20
|
+
Cukesparse.should_receive("puts").with("\e[0;33;49mYou have the following tasks within your config file: test_task, test_task1, no_defaults\e[0m")
|
21
|
+
Cukesparse.execute
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe '.load_config' do
|
4
|
+
before :each do
|
5
|
+
ARGV.clear
|
6
|
+
Cukesparse.reset!
|
7
|
+
end
|
8
|
+
|
9
|
+
context "when run with incorrect task file" do
|
10
|
+
it "will return an error if the task file fails to parse" do
|
11
|
+
Cukesparse.configure {|c| c.config_file = File.join(fixture_path, 'invalid_tasks.yml')}
|
12
|
+
Cukesparse.should_receive("abort").with("\e[4;31;49mYour tasks file did not parse as expected!\e[0m")
|
13
|
+
Cukesparse.load_config
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "when run with task file missing" do
|
18
|
+
it "will return an error if the task file is missing" do
|
19
|
+
Cukesparse.configure {|c| c.config_file = File.join(fixture_path, 'missing_tasks.yml')}
|
20
|
+
Cukesparse.should_receive("abort").with("\e[4;31;49mYour tasks file is missing!\e[0m")
|
21
|
+
Cukesparse.load_config
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,603 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe '.parse_argv' do
|
4
|
+
before :each do
|
5
|
+
ARGV.clear
|
6
|
+
Cukesparse.reset!
|
7
|
+
end
|
8
|
+
|
9
|
+
context "when run with incorrect ARGV array" do
|
10
|
+
it "will return an error if arguments are nil" do
|
11
|
+
ARGV.push(nil)
|
12
|
+
Cukesparse.should_receive("abort").with("\e[4;31;49mError processing passed CLI arguments!\e[0m")
|
13
|
+
Cukesparse.parse_argv
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "when passed the -t parameter" do
|
18
|
+
before :each do
|
19
|
+
ARGV.push('test_task', '-t', 'test')
|
20
|
+
Cukesparse.parse_argv
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should have a parameter of tags" do
|
24
|
+
Cukesparse.parameters.should have_key :tags
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should have a tags parameter value of --tags test" do
|
28
|
+
Cukesparse.parameters[:tags].should eql ['--tags test']
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "when passed the -n parameter" do
|
33
|
+
before :each do
|
34
|
+
ARGV.push('test_task', '-n', 'name_test')
|
35
|
+
Cukesparse.parse_argv
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should have a parameter of name" do
|
39
|
+
Cukesparse.parameters.should have_key :name
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should have a name parameter value of test" do
|
43
|
+
Cukesparse.parameters[:name].should eql ['--name name_test']
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "when passed the -name parameter" do
|
48
|
+
before :each do
|
49
|
+
ARGV.push('test_task', '--name', 'name_test')
|
50
|
+
Cukesparse.parse_argv
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should have a parameter of name" do
|
54
|
+
Cukesparse.parameters.should have_key :name
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should have a name parameter value of test" do
|
58
|
+
Cukesparse.parameters[:name].should eql ['--name name_test']
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context "when passed the -f parameter" do
|
63
|
+
before :each do
|
64
|
+
ARGV.push('test_task', '-f', 'pretty')
|
65
|
+
Cukesparse.parse_argv
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should have a parameter of format" do
|
69
|
+
Cukesparse.parameters.should have_key :format
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should have a tags parameter value of test" do
|
73
|
+
Cukesparse.parameters[:format].should eql '--format pretty'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context "when passed the --format parameter" do
|
78
|
+
before :each do
|
79
|
+
ARGV.push('test_task', '--format', 'pretty')
|
80
|
+
Cukesparse.parse_argv
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should have a parameter of format" do
|
84
|
+
Cukesparse.parameters.should have_key :format
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should have a tags parameter value of test" do
|
88
|
+
Cukesparse.parameters[:format].should eql '--format pretty'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "when passed the -d parameter" do
|
93
|
+
before :each do
|
94
|
+
ARGV.push('test_task', '-d')
|
95
|
+
Cukesparse.parameters = {}
|
96
|
+
Cukesparse.parse_argv
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should have a parameter of name" do
|
100
|
+
Cukesparse.parameters.should have_key :dry_run
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should have a dry_run parameter value of --dry-run" do
|
104
|
+
Cukesparse.parameters[:dry_run].should eql '--dry-run'
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
context "when passed the --dry-run parameter" do
|
109
|
+
before :each do
|
110
|
+
ARGV.push('test_task', '--dry-run')
|
111
|
+
Cukesparse.parse_argv
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should have a parameter of dry_run" do
|
115
|
+
Cukesparse.parameters.should have_key :dry_run
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should have a dry_run parameter value of --dry-run" do
|
119
|
+
Cukesparse.parameters[:dry_run].should eql '--dry-run'
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
context "when passed the -v parameter" do
|
124
|
+
before :each do
|
125
|
+
ARGV.push('test_task', '-v')
|
126
|
+
Cukesparse.parse_argv
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should have a parameter of verbose" do
|
130
|
+
Cukesparse.parameters.should have_key :verbose
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should have a verbose parameter value of --verbose" do
|
134
|
+
Cukesparse.parameters[:verbose].should eql '--verbose'
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
context "when passed the --verbose parameter" do
|
139
|
+
before :each do
|
140
|
+
ARGV.push('test_task', '--verbose')
|
141
|
+
Cukesparse.parse_argv
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should have a parameter of verbose" do
|
145
|
+
Cukesparse.parameters.should have_key :verbose
|
146
|
+
end
|
147
|
+
|
148
|
+
it "should have a verbose parameter value of --verbose" do
|
149
|
+
Cukesparse.parameters[:verbose].should eql '--verbose'
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
context "when passed the -s parameter" do
|
154
|
+
before :each do
|
155
|
+
ARGV.push('test_task', '-s')
|
156
|
+
Cukesparse.parse_argv
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should have a parameter of strict" do
|
160
|
+
Cukesparse.parameters.should have_key :strict
|
161
|
+
end
|
162
|
+
|
163
|
+
it "should have a strict parameter value of --strict" do
|
164
|
+
Cukesparse.parameters[:strict].should eql '--strict'
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context "when passed the --strict parameter" do
|
169
|
+
before :each do
|
170
|
+
ARGV.push('test_task', '-s')
|
171
|
+
Cukesparse.parse_argv
|
172
|
+
end
|
173
|
+
|
174
|
+
it "should have a parameter of --strict" do
|
175
|
+
Cukesparse.parameters.should have_key :strict
|
176
|
+
end
|
177
|
+
|
178
|
+
it "should have a strict parameter value of --strict" do
|
179
|
+
Cukesparse.parameters[:strict].should eql '--strict'
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
context "when passed the -g parameter" do
|
184
|
+
before :each do
|
185
|
+
ARGV.push('test_task', '-g')
|
186
|
+
Cukesparse.parse_argv
|
187
|
+
end
|
188
|
+
|
189
|
+
it "should have a parameter of --guess" do
|
190
|
+
Cukesparse.parameters.should have_key :guess
|
191
|
+
end
|
192
|
+
|
193
|
+
it "should have a strict parameter value of --guess" do
|
194
|
+
Cukesparse.parameters[:guess].should eql '--guess'
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
context "when passed the --guess parameter" do
|
199
|
+
before :each do
|
200
|
+
ARGV.push('test_task', '--guess')
|
201
|
+
Cukesparse.parse_argv
|
202
|
+
end
|
203
|
+
|
204
|
+
it "should have a parameter of --guess" do
|
205
|
+
Cukesparse.parameters.should have_key :guess
|
206
|
+
end
|
207
|
+
|
208
|
+
it "should have a strict parameter value of --guess" do
|
209
|
+
Cukesparse.parameters[:guess].should eql '--guess'
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
context "when passed the -x parameter" do
|
214
|
+
before :each do
|
215
|
+
ARGV.push('test_task', '-x')
|
216
|
+
Cukesparse.parse_argv
|
217
|
+
end
|
218
|
+
|
219
|
+
it "should have a parameter of --expand" do
|
220
|
+
Cukesparse.parameters.should have_key :expand
|
221
|
+
end
|
222
|
+
|
223
|
+
it "should have a strict parameter value of --expand" do
|
224
|
+
Cukesparse.parameters[:expand].should eql '--expand'
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
context "when passed the --expand parameter" do
|
229
|
+
before :each do
|
230
|
+
ARGV.push('test_task', '--expand')
|
231
|
+
Cukesparse.parse_argv
|
232
|
+
end
|
233
|
+
|
234
|
+
it "should have a parameter of --expand" do
|
235
|
+
Cukesparse.parameters.should have_key :expand
|
236
|
+
end
|
237
|
+
|
238
|
+
it "should have a strict parameter value of --expand" do
|
239
|
+
Cukesparse.parameters[:expand].should eql '--expand'
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
context "when passed the -e parameter" do
|
244
|
+
before :each do
|
245
|
+
ARGV.push('test_task', '-e', 'test_environment')
|
246
|
+
Cukesparse.parse_argv
|
247
|
+
end
|
248
|
+
|
249
|
+
it "should have a parameter of environment" do
|
250
|
+
Cukesparse.parameters.should have_key :environment
|
251
|
+
end
|
252
|
+
|
253
|
+
it "should have a environment parameter value of ENVIRONMENT=test_environment" do
|
254
|
+
Cukesparse.parameters[:environment].should eql 'ENVIRONMENT=test_environment'
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
context "when passed the --environment parameter" do
|
259
|
+
before :each do
|
260
|
+
ARGV.push('test_task', '--environment', 'test_environment')
|
261
|
+
Cukesparse.parse_argv
|
262
|
+
end
|
263
|
+
|
264
|
+
it "should have a parameter of environment" do
|
265
|
+
Cukesparse.parameters.should have_key :environment
|
266
|
+
end
|
267
|
+
|
268
|
+
it "should have a environment parameter value of ENVIRONMENT=test_environment" do
|
269
|
+
Cukesparse.parameters[:environment].should eql 'ENVIRONMENT=test_environment'
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
context "when passed the -l parameter" do
|
274
|
+
before :each do
|
275
|
+
ARGV.push('test_task', '-l', 'debug')
|
276
|
+
Cukesparse.parse_argv
|
277
|
+
end
|
278
|
+
|
279
|
+
it "should have a parameter of loglevel" do
|
280
|
+
Cukesparse.parameters.should have_key :log_level
|
281
|
+
end
|
282
|
+
|
283
|
+
it "should have a loglevel parameter value of LOG_LEVEL=debug" do
|
284
|
+
Cukesparse.parameters[:log_level].should eql 'LOG_LEVEL=debug'
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
context "when passed the --loglevel parameter" do
|
289
|
+
before :each do
|
290
|
+
ARGV.push('test_task', '--loglevel', 'debug')
|
291
|
+
Cukesparse.parse_argv
|
292
|
+
end
|
293
|
+
|
294
|
+
it "should have a parameter of loglevel" do
|
295
|
+
Cukesparse.parameters.should have_key :log_level
|
296
|
+
end
|
297
|
+
|
298
|
+
it "should have a loglevel parameter value of LOG_LEVEL=debug" do
|
299
|
+
Cukesparse.parameters[:log_level].should eql 'LOG_LEVEL=debug'
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
context "when passed the -c parameter" do
|
304
|
+
before :each do
|
305
|
+
ARGV.push('test_task', '-c', 'browser')
|
306
|
+
Cukesparse.parse_argv
|
307
|
+
end
|
308
|
+
|
309
|
+
it "should have a parameter of controller" do
|
310
|
+
Cukesparse.parameters.should have_key :controller
|
311
|
+
end
|
312
|
+
|
313
|
+
it "should have a controller parameter value of CONTROLLER=browser" do
|
314
|
+
Cukesparse.parameters[:controller].should eql 'CONTROLLER=browser'
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
context "when passed the --controller parameter" do
|
319
|
+
before :each do
|
320
|
+
ARGV.push('test_task', '--controller', 'browser')
|
321
|
+
Cukesparse.parse_argv
|
322
|
+
end
|
323
|
+
|
324
|
+
it "should have a parameter of controller" do
|
325
|
+
Cukesparse.parameters.should have_key :controller
|
326
|
+
end
|
327
|
+
|
328
|
+
it "should have a controller parameter value of CONTROLLER=browser" do
|
329
|
+
Cukesparse.parameters[:controller].should eql 'CONTROLLER=browser'
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
context "when passed the -h parameter" do
|
334
|
+
before :each do
|
335
|
+
ARGV.push('test_task', '-h')
|
336
|
+
Cukesparse.parse_argv
|
337
|
+
end
|
338
|
+
|
339
|
+
it "should have a parameter of headless" do
|
340
|
+
Cukesparse.parameters.should have_key :headless
|
341
|
+
end
|
342
|
+
|
343
|
+
it "should have a headless parameter value of HEADLESS=TRUE" do
|
344
|
+
Cukesparse.parameters[:headless].should eql 'HEADLESS=TRUE'
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
context "when passed the --headless parameter" do
|
349
|
+
before :each do
|
350
|
+
ARGV.push('test_task', '--headless')
|
351
|
+
Cukesparse.parse_argv
|
352
|
+
end
|
353
|
+
|
354
|
+
it "should have a parameter of headless" do
|
355
|
+
Cukesparse.parameters.should have_key :headless
|
356
|
+
end
|
357
|
+
|
358
|
+
it "should have a headless parameter value of HEADLESS=TRUE" do
|
359
|
+
Cukesparse.parameters[:headless].should eql 'HEADLESS=TRUE'
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
context "when passed the --cleanup parameter" do
|
364
|
+
before :each do
|
365
|
+
ARGV.push('test_task', '--cleanup')
|
366
|
+
Cukesparse.parse_argv
|
367
|
+
end
|
368
|
+
|
369
|
+
it "should have a parameter of cleanup" do
|
370
|
+
Cukesparse.parameters.should have_key :cleanup
|
371
|
+
end
|
372
|
+
|
373
|
+
it "should have a cleanup parameter value of CLEANUP=TRUE" do
|
374
|
+
Cukesparse.parameters[:cleanup].should eql 'CLEANUP=TRUE'
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
context "when passed the --no-cleanup parameter" do
|
379
|
+
before :each do
|
380
|
+
ARGV.push('test_task', '--no-cleanup')
|
381
|
+
Cukesparse.parse_argv
|
382
|
+
end
|
383
|
+
|
384
|
+
it "should have a parameter of cleanup" do
|
385
|
+
Cukesparse.parameters.should have_key :cleanup
|
386
|
+
end
|
387
|
+
|
388
|
+
it "should have a cleanup parameter value of CLEANUP=FALSE" do
|
389
|
+
Cukesparse.parameters[:cleanup].should eql 'CLEANUP=FALSE'
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
context "when passed the --database parameter" do
|
394
|
+
before :each do
|
395
|
+
ARGV.push('test_task', '--database')
|
396
|
+
Cukesparse.parse_argv
|
397
|
+
end
|
398
|
+
|
399
|
+
it "should have a parameter of database" do
|
400
|
+
Cukesparse.parameters.should have_key :database
|
401
|
+
end
|
402
|
+
|
403
|
+
it "should have a database parameter value of DATABASE=TRUE" do
|
404
|
+
Cukesparse.parameters[:database].should eql 'DATABASE=TRUE'
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
context "when passed the --jenkins parameter" do
|
409
|
+
before :each do
|
410
|
+
ARGV.push('test_task', '--jenkins')
|
411
|
+
Cukesparse.parse_argv
|
412
|
+
end
|
413
|
+
|
414
|
+
it "should have a parameter of jenkins" do
|
415
|
+
Cukesparse.parameters.should have_key :jenkins
|
416
|
+
end
|
417
|
+
|
418
|
+
it "should have a jenkins parameter value of JENKINS=TRUE" do
|
419
|
+
Cukesparse.parameters[:jenkins].should eql 'JENKINS=TRUE'
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
context "when passed the --retries parameter" do
|
424
|
+
before :each do
|
425
|
+
ARGV.push('test_task', '--retries', '5')
|
426
|
+
Cukesparse.parse_argv
|
427
|
+
end
|
428
|
+
|
429
|
+
it "should have a parameter of retries" do
|
430
|
+
Cukesparse.parameters.should have_key :retries
|
431
|
+
end
|
432
|
+
|
433
|
+
it "should have a retries parameter value of RETRIES=5" do
|
434
|
+
Cukesparse.parameters[:retries].should eql 'RETRIES=5'
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
438
|
+
context "when passed the --timeout parameter" do
|
439
|
+
before :each do
|
440
|
+
ARGV.push('test_task', '--timeout', '10')
|
441
|
+
Cukesparse.parse_argv
|
442
|
+
end
|
443
|
+
|
444
|
+
it "should have a parameter of timeout" do
|
445
|
+
Cukesparse.parameters.should have_key :timeout
|
446
|
+
end
|
447
|
+
|
448
|
+
it "should have a timeout parameter value of TIMEOUT=10" do
|
449
|
+
Cukesparse.parameters[:timeout].should eql 'TIMEOUT=10'
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
context "when passed the --screen parameter" do
|
454
|
+
before :each do
|
455
|
+
ARGV.push('test_task', '--screen', '1280/1024')
|
456
|
+
Cukesparse.parse_argv
|
457
|
+
end
|
458
|
+
|
459
|
+
it "should have a parameter of screenwidth" do
|
460
|
+
Cukesparse.parameters.should have_key :screenwidth
|
461
|
+
end
|
462
|
+
|
463
|
+
it "should have a parameter of screenheight" do
|
464
|
+
Cukesparse.parameters.should have_key :screenheight
|
465
|
+
end
|
466
|
+
|
467
|
+
it "should have a screenwidth parameter value of SCREENWIDTH=1280" do
|
468
|
+
Cukesparse.parameters[:screenwidth].should eql 'SCREENWIDTH=1280'
|
469
|
+
end
|
470
|
+
|
471
|
+
it "should have a screenheight parameter value of SCREENHEIGHT=1024" do
|
472
|
+
Cukesparse.parameters[:screenheight].should eql 'SCREENHEIGHT=1024'
|
473
|
+
end
|
474
|
+
end
|
475
|
+
|
476
|
+
context "when passed the --position parameter" do
|
477
|
+
before :each do
|
478
|
+
ARGV.push('test_task', '--position', '0/0')
|
479
|
+
Cukesparse.parse_argv
|
480
|
+
end
|
481
|
+
|
482
|
+
it "should have a parameter of xposition" do
|
483
|
+
Cukesparse.parameters.should have_key :xposition
|
484
|
+
end
|
485
|
+
|
486
|
+
it "should have a parameter of yposition" do
|
487
|
+
Cukesparse.parameters.should have_key :yposition
|
488
|
+
end
|
489
|
+
|
490
|
+
it "should have a xposition parameter value of XPOSITION=0" do
|
491
|
+
Cukesparse.parameters[:xposition].should eql 'XPOSITION=0'
|
492
|
+
end
|
493
|
+
|
494
|
+
it "should have a yposition parameter value of YPOSITION=0" do
|
495
|
+
Cukesparse.parameters[:yposition].should eql 'YPOSITION=0'
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
context "when passed the --screenwidth parameter" do
|
500
|
+
before :each do
|
501
|
+
ARGV.push('test_task', '--screenwidth', '1280')
|
502
|
+
Cukesparse.parse_argv
|
503
|
+
end
|
504
|
+
|
505
|
+
it "should have a parameter of screenwidth" do
|
506
|
+
Cukesparse.parameters.should have_key :screen_width
|
507
|
+
end
|
508
|
+
|
509
|
+
it "should have a screenwidth parameter value of SCREENWIDTH=1280" do
|
510
|
+
Cukesparse.parameters[:screen_width].should eql 'SCREENWIDTH=1280'
|
511
|
+
end
|
512
|
+
end
|
513
|
+
|
514
|
+
context "when passed the --screenheight parameter" do
|
515
|
+
before :each do
|
516
|
+
ARGV.push('test_task', '--screenheight', '1024')
|
517
|
+
Cukesparse.parse_argv
|
518
|
+
end
|
519
|
+
|
520
|
+
it "should have a parameter of screenheight" do
|
521
|
+
Cukesparse.parameters.should have_key :screen_height
|
522
|
+
end
|
523
|
+
|
524
|
+
it "should have a screenheight parameter value of SCREENHEIGHT=1024" do
|
525
|
+
Cukesparse.parameters[:screen_height].should eql 'SCREENHEIGHT=1024'
|
526
|
+
end
|
527
|
+
end
|
528
|
+
|
529
|
+
context "when passed the --xposition parameter" do
|
530
|
+
before :each do
|
531
|
+
ARGV.push('test_task', '--xposition', '100')
|
532
|
+
Cukesparse.parse_argv
|
533
|
+
end
|
534
|
+
|
535
|
+
it "should have a parameter of xposition" do
|
536
|
+
Cukesparse.parameters.should have_key :xposition
|
537
|
+
end
|
538
|
+
|
539
|
+
it "should have a xposition parameter value of XPOSITION=100" do
|
540
|
+
Cukesparse.parameters[:xposition].should eql 'XPOSITION=100'
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
544
|
+
context "when passed the --yposition parameter" do
|
545
|
+
before :each do
|
546
|
+
ARGV.push('test_task', '--yposition', '100')
|
547
|
+
Cukesparse.parse_argv
|
548
|
+
end
|
549
|
+
|
550
|
+
it "should have a parameter of yposition" do
|
551
|
+
Cukesparse.parameters.should have_key :yposition
|
552
|
+
end
|
553
|
+
|
554
|
+
it "should have a yposition parameter value of YPOSITION=100" do
|
555
|
+
Cukesparse.parameters[:yposition].should eql 'YPOSITION=100'
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
559
|
+
context "when passed the -H parameter" do
|
560
|
+
before :each do
|
561
|
+
ARGV.push('test_task', '-H')
|
562
|
+
Cukesparse.parse_argv
|
563
|
+
end
|
564
|
+
|
565
|
+
it "should have a parameter of highlight" do
|
566
|
+
Cukesparse.parameters.should have_key :highlight
|
567
|
+
end
|
568
|
+
|
569
|
+
it "should have a highlight parameter value of HIGHLIGHT=TRUE" do
|
570
|
+
Cukesparse.parameters[:highlight].should eql 'HIGHLIGHT=TRUE'
|
571
|
+
end
|
572
|
+
end
|
573
|
+
|
574
|
+
context "when passed the --highlight parameter" do
|
575
|
+
before :each do
|
576
|
+
ARGV.push('test_task', '--highlight')
|
577
|
+
Cukesparse.parse_argv
|
578
|
+
end
|
579
|
+
|
580
|
+
it "should have a parameter of highlight" do
|
581
|
+
Cukesparse.parameters.should have_key :highlight
|
582
|
+
end
|
583
|
+
|
584
|
+
it "should have a highlight parameter value of HIGHLIGHT=TRUE" do
|
585
|
+
Cukesparse.parameters[:highlight].should eql 'HIGHLIGHT=TRUE'
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
context "when passed the --debug parameter" do
|
590
|
+
before :each do
|
591
|
+
ARGV.push('test_task', '--debug')
|
592
|
+
Cukesparse.parse_argv
|
593
|
+
end
|
594
|
+
|
595
|
+
it "should have a parameter of debug" do
|
596
|
+
Cukesparse.parameters.should have_key :debug
|
597
|
+
end
|
598
|
+
|
599
|
+
it "should have a debug parameter value of DEBUG=TRUE" do
|
600
|
+
Cukesparse.parameters[:debug].should eql 'DEBUG=TRUE'
|
601
|
+
end
|
602
|
+
end
|
603
|
+
end
|