cukesparse 1.0.11 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c6e7f9d088bb34fdf58f7ab912f49997c5a51550
4
- data.tar.gz: c533274cde0f41a6614c96a9a448d51e24599d91
5
- SHA512:
6
- metadata.gz: e32b72fe81740fdde881f14044ebd87e86c56ecf887865c70a67bfc6e6fe523c55725d7709e3af285fc1e924ac1b8d857f3e4bfb6227363d8dc9ee73abdb995a
7
- data.tar.gz: 2c6da3941b6400f9ed9ae173a5d32e81b1c62d909e03a5d66031686b03ee761ce3b86bef92e13d0b86b451e89b83a963f56b9f767207c8ce8747962331e28d86
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ N2FkNTQ5ZjkyZWZjN2U3MmZhMTJlNjk5YWU0MjAyMTAxMTNlYmM5Zg==
5
+ data.tar.gz: !binary |-
6
+ ZDQ2YmQ0YTQwMzU3N2JlOWQxYTBiMGZhZjJmYjNkMTFmMmVjMjcxOA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YzJlMzcxNTExYjE5OWE0ZWRmNGI2ZWIwY2QyOWViMzM2OGU1NzI3Y2E2OTgw
10
+ YjU0Yjg4NmJmNThhNmE3M2IxM2EzZWM3ZjZjNmJlNGEzMDU3ZDhmMzJiODcy
11
+ MTg1YTkwZDI1NDVjNGIzMTVhOThiNDFmMmE2ZDEzMzYzN2I3YTA=
12
+ data.tar.gz: !binary |-
13
+ MjA2Yjk1NjM5N2ZhMjk1NjA4MTQ0YWJiMjkwODk3YmI4NjMyYzUxN2IyZjQ1
14
+ OGRjMjc4ZDdmYTVhM2U0YTE2ZjQ2YzI1MzA3ZTJiM2E5NzFiNGY5NDAxZTgx
15
+ ZDJlMGFkZTlkMTM1NWU4YjU3MjczZmUxZWZkOTcxODA4NTQzODM=
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'bundler', '~> 1.1'
4
- gem "coveralls", "~> 0.6.6", require: false
3
+ gem 'bundler', '~> 1.3.4'
4
+ gem "coveralls", "~> 0.6.7", require: false
5
5
 
6
6
  gemspec
data/README.md CHANGED
@@ -4,18 +4,59 @@
4
4
 
5
5
  #cukesparse
6
6
 
7
- A simple command line parser to pass default and custom arguments into Cucumber.
7
+ A simple command line parser to pass default and custom arguments into Cucumber with the power to define these as tasks in a config/tasks.yml file!
8
8
 
9
9
  ## Getting Started
10
- Cukesparse parses command line arguments and sets default arguments from the config/task.yml file. For example please see the example config task below:
10
+ Cukesparse parses command line arguments and sets default arguments from the config/task.yml file. For example please see the full list of options within the example config below:
11
11
 
12
12
  test_task:
13
- feature_order: ['features/featureOne', 'features/featureTwo', 'features/featureThree']
14
- runtime_defaults:
15
- environment: 'release'
16
- log_level: 'debug'
17
- format: 'pretty'
18
- defaults: ['--format html', '--out coverage/report.html', '-P -s']
13
+ feature_order: ['features/featureOne', 'features/featureTwo', 'features/featureThree']
14
+
15
+ # These cucumber defaults will be set if not passed in from cli
16
+ cucumber_defaults:
17
+ format: 'pretty'
18
+ name: ['feature1', 'feature2']
19
+ tags: ['tags1', 'tags2']
20
+ strict: true
21
+ verbose: true
22
+ dry_run: true
23
+ guess: true
24
+ expand: true
25
+
26
+ # These runtime defaults will be set if not passed in from cli
27
+ runtime_defaults:
28
+ environment: 'release'
29
+ log_level: 'debug'
30
+ cleanup: true
31
+ database: true
32
+ jenkins: true
33
+ retries: 5
34
+ timeout: 60
35
+ screen: 1280/1024
36
+ screenwidth: 1280
37
+ screenheight: 1024
38
+ position: 0/0
39
+ xposition: 0
40
+ yposition: 0
41
+ highlight: true
42
+
43
+ # Will always be added to end of of the system command
44
+ defaults: ['--format html', '--out report.html', '-P -s']
45
+
46
+ You can have many highlevel tasks defined within your config/tasks.yml file. In the above example we only have the task `test_task`. Please note that the screen and position config options will set screenwidth/screenheight or xposition/yposition parameters. You should use screen/position or define the individual options only within the config file!
47
+
48
+ ## Lets get it running!
49
+
50
+ Lets say we have the following simple config file options defined:
51
+
52
+ test_task:
53
+ feature_order: ['features/featureOne', 'features/featureTwo', 'features/featureThree']
54
+ cucumber_defaults:
55
+ format: 'pretty'
56
+ runtime_defaults:
57
+ environment: 'release'
58
+ log_level: 'debug'
59
+ defaults: ['--format html', '--out coverage/report.html', '-P -s']
19
60
 
20
61
  If you were to run the following command `cukesparse test_task -t test` cukesparse would be passed the following arguments:
21
62
 
@@ -23,15 +64,15 @@ If you were to run the following command `cukesparse test_task -t test` cukespar
23
64
 
24
65
  Cukesparse would then collate and produce the following parameters hash:
25
66
 
26
- {:tags=>["--tags test"], :environment=>"ENVIRONMENT=release", :log_level=>"LOG_LEVEL=debug", :format=>"FORMAT=pretty"}
67
+ {:tags=>["--tags test"], :format=>"--format pretty", :environment=>"ENVIRONMENT=release", :log_level=>"LOG_LEVEL=debug"}
27
68
 
28
- As no `environment`, `log_level` or `format` arguments were passed the runtime defaults from the config/tasks.yml are used. The following command line output would be produced:
69
+ As no `environment`, `log_level` arguments were passed the runtime defaults from the config/tasks.yml are used. The following command line output would be produced and run:
29
70
 
30
71
  bundle exec cucumber --require features/ features/featureOne features/featureTwo features/featureThree --tags test
31
72
  ENVIRONMENT=release LOG_LEVEL=debug FORMAT=pretty --format html --out coverage/report.html -P -s
32
73
 
33
74
  ## Parameters
34
- Cukesparse accepts the following parameters:
75
+ Cukesparse accepts the following command line arguments:
35
76
 
36
77
  ### Cucumber options
37
78
  '-t' e.g. -t @abc
@@ -43,7 +84,7 @@ Cukesparse accepts the following parameters:
43
84
  '-g --guess'
44
85
  '-x --expand'
45
86
 
46
- ### Custom options
87
+ ### Runtime options
47
88
  All arguments below have been setup for a custom project but are useful.
48
89
 
49
90
  ### Global options
@@ -63,8 +104,8 @@ All arguments below have been setup for a custom project but are useful.
63
104
  '--timeout' e.g. --timeout 60
64
105
 
65
106
  ### Driver Options
66
- '--screen' e.g. --screen 1024,1280
67
- '--position' e.g. --position 0,0
107
+ '--screen' e.g. --screen 1024/1280
108
+ '--position' e.g. --position 0/0
68
109
  '--screenwidth' e.g. --screenwidth 1024
69
110
  '--screenheight' e.g. --screenheight 1280
70
111
  '--xposition' e.g. --xposition 0
@@ -77,6 +118,24 @@ When the `--debug` argument is passed it only outputs what would have been produ
77
118
 
78
119
  '--debug'
79
120
 
121
+ So for example if you ran the following:
122
+
123
+ cukesparse test_task -t test --debug
124
+
125
+ You would get the following returned in the console:
126
+
127
+ DEBUG: Outputting ARGV passed
128
+ ["test_task", "-t", "test", "--debug"]
129
+
130
+ DEBUG: Outputting parsed config file
131
+ {"test_task"=>{"feature_order"=>["features/featureOne", "features/featureTwo", "features/featureThree"], "cucumber_defaults"=>{"format"=>"pretty"}, "runtime_defaults"=>{"environment"=>"release", "log_level"=>"debug"}, "defaults"=>["--format html", "--out coverage/report.html", "-P -s"]}}
132
+
133
+ DEBUG: Outputting parameters created
134
+ {:tags=>["--tags test"], :debug=>"DEBUG=TRUE", :format=>"--format pretty", :environment=>"ENVIRONMENT=release", :log_level=>"LOG_LEVEL=debug"}
135
+
136
+ DEBUG: Outputting commandc created
137
+ bundle exec cucumber --require features/ features/featureOne features/featureTwo features/featureThree --tags test DEBUG=TRUE --format pretty ENVIRONMENT=release LOG_LEVEL=debug --format html --out coverage/report.html -P -s
138
+
80
139
  ## Tests
81
140
  There are a number of unit tests which are included as part of this project which are run by rspec. Please run:
82
141
 
data/config/tasks.yml CHANGED
@@ -1,6 +1,33 @@
1
1
  test_task:
2
2
  feature_order: ['features/featureOne', 'features/featureTwo', 'features/featureThree']
3
+
4
+ # These cucumber defaults be set if not passed in from cli
5
+ cucumber_defaults:
6
+ format: 'pretty'
7
+ name: ['feature1', 'feature2']
8
+ tags: ['tags1', 'tags2']
9
+ strict: true
10
+ verbose: true
11
+ dry_run: true
12
+ guess: true
13
+ expand: true
14
+
15
+ # These runtime defaults be set if not passed in from cli
3
16
  runtime_defaults:
4
17
  environment: 'release'
5
18
  log_level: 'debug'
6
- defaults: ['--format html', '--out coverage/report.html', '--format pretty', '-P -s']
19
+ cleanup: true
20
+ database: true
21
+ jenkins: true
22
+ retries: 5
23
+ timeout: 60
24
+ screen: 1280/1024
25
+ screenwidth: 1280
26
+ screenheight: 1024
27
+ position: 0/0
28
+ xposition: 0
29
+ yposition: 0
30
+ highlight: true
31
+
32
+ # Will always be added to end of of the system command
33
+ defaults: ['--format html', '--out report.html', '-P -s']
data/cukesparse.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'cukesparse'
3
- s.version = '1.0.11'
4
- s.date = '2013-06-04'
3
+ s.version = '2.0.0'
4
+ s.date = '2013-06-08'
5
5
  s.summary = 'Cukesparse - cucumber command line parser'
6
6
  s.description = 'A simple command line parser to pass arguments into Cucumber'
7
7
  s.author = 'Jonathan Chrisp'
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.add_runtime_dependency 'clik', '~> 0.1.0'
17
17
  s.add_runtime_dependency 'colored', '~> 1.2'
18
- s.add_runtime_dependency 'cucumber', '~> 1.3.1'
18
+ s.add_runtime_dependency 'cucumber', '~> 1.3.2'
19
19
 
20
20
  s.files = `git ls-files`.split("\n")
21
21
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
data/lib/cukesparse.rb CHANGED
@@ -5,7 +5,6 @@ require 'pry'
5
5
  YAML::ENGINE.yamler = 'psych'
6
6
 
7
7
  module Cukesparse
8
-
9
8
  class << self
10
9
  attr_accessor :config_file, :config, :task, :parameters, :command
11
10
 
@@ -25,7 +24,7 @@ module Cukesparse
25
24
  cli argv,
26
25
  # Cucumber options
27
26
  '-t' => lambda{ |t| add_multiple(:tags, t) },
28
- '-n --name' => lambda{ |n| @parameters[:name] = "--name #{n}" },
27
+ '-n --name' => lambda{ |n| add_multiple(:name, n) },
29
28
  '-f --format' => ->(f){ @parameters[:format] = "--format #{f}" },
30
29
  '-d --dry-run' => ->{ @parameters[:dry_run] = "--dry-run" },
31
30
  '-v --verbose' => ->{ @parameters[:verbose] = "--verbose" },
@@ -72,12 +71,13 @@ module Cukesparse
72
71
  def build_command
73
72
  check_for_task
74
73
  check_for_parameters
74
+ set_cucumber_defaults
75
75
  set_runtime_defaults
76
76
 
77
77
  unless @task.empty? && @parameters.empty?
78
78
  @command.push 'bundle exec cucumber'
79
79
  @command.push '--require features/'
80
- #@command.push task['feature_order'].join(' ')
80
+ @command.push task['feature_order'].join(' ')
81
81
  @parameters.each { |k,v| @command.push(v) }
82
82
  @command.push task['defaults'].join(' ')
83
83
  end
@@ -98,32 +98,31 @@ module Cukesparse
98
98
  puts @config.inspect
99
99
  puts 'DEBUG: Outputting parameters created'.yellow
100
100
  puts @parameters.inspect
101
- puts 'DEBUG: Outputting command line created'.yellow
101
+ puts 'DEBUG: Outputting commandc created'.yellow
102
102
  puts @command.join(' ')
103
103
  end
104
104
 
105
105
  # Loads the config file
106
106
  def load_config
107
107
  begin
108
- @config = YAML.load_file(@config_file)
108
+ @config = YAML.load_file @config_file
109
109
  rescue Psych::SyntaxError
110
110
  abort 'Your tasks file did not parse as expected!'.red.underline
111
111
  rescue Errno::ENOENT
112
112
  abort 'Your tasks file is missing!'.red.underline
113
113
  end
114
-
115
114
  self
116
115
  end
117
116
 
118
117
  # Checks for task in arguments
119
118
  def check_for_task
120
- any_task = argv & @config.keys
121
- if any_task.empty?
119
+ task = argv & @config.keys
120
+ if task.empty?
122
121
  abort 'ERROR: No task was passed to cukesparse!'.red.underline
123
- elsif any_task.length > 1
124
- abort 'ERROR: Multiple tasks have been passed!'.red.underline
122
+ elsif task.length > 1
123
+ puts 'WARN: Multiple tasks have been passed!'.yellow
125
124
  else
126
- @task = @config[any_task[0]]
125
+ @task = @config[task[0]]
127
126
  end
128
127
  end
129
128
 
@@ -136,10 +135,15 @@ module Cukesparse
136
135
 
137
136
  # Updates parameters based on config runtime defaults
138
137
  def set_runtime_defaults
139
- if @task.has_key?('runtime_defaults')
140
- @task['runtime_defaults'].each do |key, value|
141
- unless @parameters.has_key? key.to_sym
142
- @parameters[key.to_sym] = key.upcase + '=' + value.to_s
138
+ if @task.has_key? 'runtime_defaults'
139
+ @task['runtime_defaults'].each do |key, val|
140
+ case key.to_sym
141
+ when :screen, :position
142
+ split_parameters(val, key.to_sym)
143
+ else
144
+ unless @parameters.has_key? key.to_sym
145
+ @parameters[key.to_sym] = key.upcase + '=' + val.to_s
146
+ end
143
147
  end
144
148
  end
145
149
  else
@@ -147,20 +151,55 @@ module Cukesparse
147
151
  end
148
152
  end
149
153
 
154
+ # Updates parameters based on config cucumber defaults
155
+ def set_cucumber_defaults
156
+ if @task.has_key? 'cucumber_defaults'
157
+ @task['cucumber_defaults'].each do |key, val|
158
+ case key.to_sym
159
+ when :tags, :name
160
+ add_multiple key.to_sym, val
161
+ when :format
162
+ unless @parameters.has_key? key.to_sym
163
+ @parameters[key.to_sym] = '--' + key.downcase + ' ' + val.to_s
164
+ end
165
+ when :strict, :verbose, :guess, :expand
166
+ unless @parameters.has_key? key.to_sym && @parameters[key.to_sym] == true
167
+ @parameters[key.to_sym] = '--' + key.downcase
168
+ end
169
+ when :dry_run
170
+ unless @parameters.has_key? key.to_sym && @parameters[key.to_sym] == true
171
+ @parameters[key.to_sym] = '--dry-run'
172
+ end
173
+ else
174
+ puts 'WARN: The cucumber default ' + key.to_s + ' isn\'t a known option!'.yellow
175
+ end
176
+ end
177
+ else
178
+ puts 'WARN: The task has no cucumber defaults!'.yellow
179
+ end
180
+ end
181
+
150
182
  # Add multiple options to key
151
183
  #
152
184
  # @param [Symbol] key the key to store in options
153
185
  # @param [String] val the arguments passed in for key
154
- def add_multiple(key, val)
155
- (@parameters[key] ||= []).push('--' + key.to_s + ' ' + val)
186
+ def add_multiple key, val
187
+ case val
188
+ when Array
189
+ val.each do |v|
190
+ (@parameters[key] ||= []).push '--' + key.to_s + ' ' + v.to_s
191
+ end
192
+ else
193
+ (@parameters[key] ||= []).push '--' + key.to_s + ' ' + val.to_s
194
+ end
156
195
  end
157
196
 
158
197
  # Splits parameters passed
159
198
  #
160
199
  # @param [String] params the parameters passed
161
200
  # @param [Symbol] sym the symbol passed
162
- def split_parameters(params, sym)
163
- params = params.split(',')
201
+ def split_parameters params, sym
202
+ params = params.split '/'
164
203
  if params.length == 1
165
204
  abort "ERROR: You have not passed enough parameters in the #{sym.to_s} command line argument!".red.underline
166
205
  elsif params.length > 2
@@ -169,9 +208,11 @@ module Cukesparse
169
208
 
170
209
  case sym
171
210
  when :screen
172
- @parameters[sym] = "SCREENWIDTH=#{params[0]} SCREENHEIGHT=#{params[1]}"
211
+ @parameters[:screenwidth] = "SCREENWIDTH=#{params[0]}"
212
+ @parameters[:screenheight] = "SCREENHEIGHT=#{params[1]}"
173
213
  when :position
174
- @parameters[sym] = "XPOSITION=#{params[0]} YPOSITION=#{params[1]}"
214
+ @parameters[:xposition] = "XPOSITION=#{params[0]}"
215
+ @parameters[:yposition] = "YPOSITION=#{params[1]}"
175
216
  end
176
217
  end
177
218
  end
data/report.html ADDED
File without changes
@@ -64,7 +64,7 @@ describe "cukesparse" do
64
64
  end
65
65
 
66
66
  it "should have a name parameter value of test" do
67
- Cukesparse.parameters[:name].should eql '--name name_test'
67
+ Cukesparse.parameters[:name].should eql ['--name name_test']
68
68
  end
69
69
  end
70
70
 
@@ -81,7 +81,7 @@ describe "cukesparse" do
81
81
  end
82
82
 
83
83
  it "should have a name parameter value of test" do
84
- Cukesparse.parameters[:name].should eql '--name name_test'
84
+ Cukesparse.parameters[:name].should eql ['--name name_test']
85
85
  end
86
86
  end
87
87
 
@@ -530,34 +530,50 @@ describe "cukesparse" do
530
530
  context "when passed the --screen parameter" do
531
531
  before :all do
532
532
  # Clear arguments as rspec passes in script path
533
- ARGV.push('test_task', '--screen', '1280,1024')
533
+ ARGV.push('test_task', '--screen', '1280/1024')
534
534
  Cukesparse.parameters = {}
535
535
  Cukesparse.parse_argv
536
536
  end
537
537
 
538
- it "should have a parameter of screen" do
539
- Cukesparse.parameters.should have_key :screen
538
+ it "should have a parameter of screenwidth" do
539
+ Cukesparse.parameters.should have_key :screenwidth
540
+ end
541
+
542
+ it "should have a parameter of screenheight" do
543
+ Cukesparse.parameters.should have_key :screenheight
544
+ end
545
+
546
+ it "should have a screenwidth parameter value of SCREENWIDTH=1280" do
547
+ Cukesparse.parameters[:screenwidth].should eql 'SCREENWIDTH=1280'
540
548
  end
541
549
 
542
- it "should have a screen parameter value of SCREENWIDTH=1280 SCREENHEIGHT=1024" do
543
- Cukesparse.parameters[:screen].should eql 'SCREENWIDTH=1280 SCREENHEIGHT=1024'
550
+ it "should have a screenheight parameter value of SCREENHEIGHT=1024" do
551
+ Cukesparse.parameters[:screenheight].should eql 'SCREENHEIGHT=1024'
544
552
  end
545
553
  end
546
554
 
547
555
  context "when passed the --position parameter" do
548
556
  before :all do
549
557
  # Clear arguments as rspec passes in script path
550
- ARGV.push('test_task', '--position', '0,0')
558
+ ARGV.push('test_task', '--position', '0/0')
551
559
  Cukesparse.parameters = {}
552
560
  Cukesparse.parse_argv
553
561
  end
554
562
 
555
- it "should have a parameter of position" do
556
- Cukesparse.parameters.should have_key :position
563
+ it "should have a parameter of xposition" do
564
+ Cukesparse.parameters.should have_key :xposition
565
+ end
566
+
567
+ it "should have a parameter of yposition" do
568
+ Cukesparse.parameters.should have_key :yposition
569
+ end
570
+
571
+ it "should have a xposition parameter value of XPOSITION=0" do
572
+ Cukesparse.parameters[:xposition].should eql 'XPOSITION=0'
557
573
  end
558
574
 
559
- it "should have a position parameter value of XPOSITION=0 YPOSITION=0" do
560
- Cukesparse.parameters[:position].should eql 'XPOSITION=0 YPOSITION=0'
575
+ it "should have a yposition parameter value of YPOSITION=0" do
576
+ Cukesparse.parameters[:yposition].should eql 'YPOSITION=0'
561
577
  end
562
578
  end
563
579
 
@@ -708,37 +724,121 @@ describe "cukesparse" do
708
724
  it "should have runtime default parameters" do
709
725
  Cukesparse.parameters.should have_key :environment
710
726
  Cukesparse.parameters.should have_key :log_level
727
+ Cukesparse.parameters.should have_key :cleanup
728
+ Cukesparse.parameters.should have_key :database
729
+ Cukesparse.parameters.should have_key :jenkins
730
+ Cukesparse.parameters.should have_key :retries
731
+ Cukesparse.parameters.should have_key :timeout
732
+ Cukesparse.parameters.should have_key :screenwidth
733
+ Cukesparse.parameters.should have_key :screenheight
734
+ Cukesparse.parameters.should have_key :xposition
735
+ Cukesparse.parameters.should have_key :yposition
736
+ Cukesparse.parameters.should have_key :highlight
711
737
  end
712
738
 
713
739
  it "should have the expected default runtime parameter values" do
714
740
  Cukesparse.parameters[:environment].should eql 'ENVIRONMENT=release'
715
741
  Cukesparse.parameters[:log_level].should eql 'LOG_LEVEL=debug'
742
+ Cukesparse.parameters[:cleanup].should eql 'CLEANUP=true'
743
+ Cukesparse.parameters[:database].should eql 'DATABASE=true'
744
+ Cukesparse.parameters[:jenkins].should eql 'JENKINS=true'
745
+ Cukesparse.parameters[:retries].should eql 'RETRIES=5'
746
+ Cukesparse.parameters[:timeout].should eql 'TIMEOUT=60'
747
+ Cukesparse.parameters[:screenwidth].should eql 'SCREENWIDTH=1280'
748
+ Cukesparse.parameters[:screenheight].should eql 'SCREENHEIGHT=1024'
749
+ Cukesparse.parameters[:xposition].should eql 'XPOSITION=0'
750
+ Cukesparse.parameters[:yposition].should eql 'YPOSITION=0'
751
+ Cukesparse.parameters[:highlight].should eql 'HIGHLIGHT=true'
752
+ end
753
+ end
754
+
755
+ context "when running the test task cucumber default vars should be set when no arguments passed" do
756
+ before :all do
757
+ # Clear arguments as rspec passes in script path
758
+ # Adding test tag to prevent raise
759
+ ARGV.push('test_task', '-t', 'test')
760
+ Cukesparse.parameters = {}
761
+ Cukesparse.configure {|c| c.config_file = './spec/spec_files/valid_tasks.yml'}
762
+ Cukesparse.load_config.parse_argv
763
+ Cukesparse.check_for_task
764
+ Cukesparse.check_for_parameters
765
+ Cukesparse.set_cucumber_defaults
766
+ end
767
+
768
+ it "should have cucumber default parameters" do
769
+ Cukesparse.parameters.should have_key :format
770
+ Cukesparse.parameters.should have_key :name
771
+ Cukesparse.parameters.should have_key :tags
772
+ Cukesparse.parameters.should have_key :strict
773
+ Cukesparse.parameters.should have_key :verbose
774
+ Cukesparse.parameters.should have_key :dry_run
775
+ Cukesparse.parameters.should have_key :guess
776
+ Cukesparse.parameters.should have_key :expand
777
+ end
778
+
779
+ it "should have the expected default runtime parameter values" do
780
+ Cukesparse.parameters[:format].should eql '--format pretty'
781
+ Cukesparse.parameters[:name].should eql ['--name feature1', '--name feature2']
782
+ Cukesparse.parameters[:tags].should eql ['--tags test', '--tags tags1', '--tags tags2']
783
+ Cukesparse.parameters[:strict].should eql '--strict'
784
+ Cukesparse.parameters[:verbose].should eql '--verbose'
785
+ Cukesparse.parameters[:dry_run].should eql '--dry-run'
786
+ Cukesparse.parameters[:guess].should eql '--guess'
787
+ Cukesparse.parameters[:expand].should eql '--expand'
716
788
  end
717
789
  end
718
790
 
719
791
  # add_multiple
720
- context "when add_multiple is called" do
721
- it "it will add a key to parameters with the correct array value" do
722
- Cukesparse.add_multiple(:test, 'abc')
723
- Cukesparse.parameters.should have_key(:test)
724
- Cukesparse.parameters[:test].should eql ['--test abc']
792
+ context "when add_multiple is called with a single value" do
793
+ before do
794
+ Cukesparse.parameters = {}
795
+ end
796
+
797
+ it "will add a key to parameters with the correct array value" do
798
+ Cukesparse.add_multiple(:tags, 'abc')
799
+ Cukesparse.parameters.should have_key(:tags)
800
+ Cukesparse.parameters[:tags].should eql ['--tags abc']
801
+ end
802
+ end
803
+
804
+ context "when add_multiple is called with multiple values" do
805
+ before do
806
+ Cukesparse.parameters = {}
807
+ end
808
+
809
+ it "will add a key to parameters with the correct array values" do
810
+ Cukesparse.add_multiple(:tags, ['abc', 'def', 'hij'])
811
+ Cukesparse.parameters.should have_key(:tags)
812
+ Cukesparse.parameters[:tags].should eql ['--tags abc', '--tags def', '--tags hij']
725
813
  end
726
814
  end
727
815
 
728
816
  # split_parameters
729
817
  context "when split parameters sends :screen symbol with arguments" do
818
+ before do
819
+ Cukesparse.parameters = {}
820
+ end
821
+
730
822
  it "will return set a parameters screen key and value" do
731
- Cukesparse.split_parameters('1024,1280', :screen)
732
- Cukesparse.parameters.should have_key(:screen)
733
- Cukesparse.parameters[:screen].should eql "SCREENWIDTH=1024 SCREENHEIGHT=1280"
823
+ Cukesparse.split_parameters('1024/1280', :screen)
824
+ Cukesparse.parameters.should have_key(:screenwidth)
825
+ Cukesparse.parameters.should have_key(:screenheight)
826
+ Cukesparse.parameters[:screenwidth].should eql "SCREENWIDTH=1024"
827
+ Cukesparse.parameters[:screenheight].should eql "SCREENHEIGHT=1280"
734
828
  end
735
829
  end
736
830
 
737
831
  context "when split parameters sends :position symbol with arguments" do
832
+ before do
833
+ Cukesparse.parameters = {}
834
+ end
835
+
738
836
  it "will return set a parameters screen key and value" do
739
- Cukesparse.split_parameters('0,100', :position)
740
- Cukesparse.parameters.should have_key(:position)
741
- Cukesparse.parameters[:position].should eql "XPOSITION=0 YPOSITION=100"
837
+ Cukesparse.split_parameters('0/100', :position)
838
+ Cukesparse.parameters.should have_key(:xposition)
839
+ Cukesparse.parameters.should have_key(:yposition)
840
+ Cukesparse.parameters[:xposition].should eql "XPOSITION=0"
841
+ Cukesparse.parameters[:yposition].should eql "YPOSITION=100"
742
842
  end
743
843
  end
744
844
 
@@ -781,7 +881,7 @@ describe "cukesparse" do
781
881
  ARGV.push('test_task', 'test_task1')
782
882
  Cukesparse.configure {|c| c.config_file = './spec/spec_files/valid_tasks.yml'}
783
883
  Cukesparse.load_config
784
- Cukesparse.should_receive("abort").with("\e[4;31;49mERROR: Multiple tasks have been passed!\e[0m")
884
+ Cukesparse.should_receive("puts").with("\e[0;33;49mWARN: Multiple tasks have been passed!\e[0m")
785
885
  Cukesparse.check_for_task
786
886
  end
787
887
  end
@@ -796,7 +896,7 @@ describe "cukesparse" do
796
896
 
797
897
  context "when CLI is run with no runtime_defaults defined" do
798
898
  it "will return a warning if no runtime_defaults are provided" do
799
- ARGV.push('no_runtime_defaults')
899
+ ARGV.push('no_defaults')
800
900
  Cukesparse.configure {|c| c.config_file = './spec/spec_files/valid_tasks.yml'}
801
901
  Cukesparse.load_config
802
902
  Cukesparse.check_for_task
@@ -805,6 +905,17 @@ describe "cukesparse" do
805
905
  end
806
906
  end
807
907
 
908
+ context "when CLI is run with no cucumber_defaults defined" do
909
+ it "will return a warning if no cucumber_defaults are provided" do
910
+ ARGV.push('no_defaults')
911
+ Cukesparse.configure {|c| c.config_file = './spec/spec_files/valid_tasks.yml'}
912
+ Cukesparse.load_config
913
+ Cukesparse.check_for_task
914
+ Cukesparse.should_receive("puts").with("\e[0;33;49mWARN: The task has no cucumber defaults!\e[0m")
915
+ Cukesparse.set_cucumber_defaults
916
+ end
917
+ end
918
+
808
919
  context "when CLI is run with and split paramters which sends one argument" do
809
920
  it "will return a error" do
810
921
  Cukesparse.should_receive("abort").with("\e[4;31;49mERROR: You have not passed enough parameters in the test command line argument!\e[0m")
@@ -815,7 +926,7 @@ describe "cukesparse" do
815
926
  context "when CLI is run with and split paramters which over two argument" do
816
927
  it "will return a error" do
817
928
  Cukesparse.should_receive("abort").with("\e[4;31;49mERROR: You have passed to many parameters in the test command line argument!\e[0m")
818
- Cukesparse.split_parameters('1024,1280,16', :test)
929
+ Cukesparse.split_parameters('1024/1280/16', :test)
819
930
  end
820
931
  end
821
932
  end
@@ -1,17 +1,37 @@
1
1
  test_task:
2
2
  feature_order: ['features/featureOne', 'features/featureTwo', 'features/featureThree']
3
+ cucumber_defaults:
4
+ format: 'pretty'
5
+ name: ['feature1', 'feature2']
6
+ tags: ['tags1', 'tags2']
7
+ strict: true
8
+ verbose: true
9
+ dry_run: true
10
+ guess: true
11
+ expand: true
3
12
  runtime_defaults:
4
13
  environment: 'release'
5
14
  log_level: 'debug'
6
- defaults: ['--format html', '--out coverage/report.html', '--format pretty', '-P -s']
15
+ cleanup: true
16
+ database: true
17
+ jenkins: true
18
+ retries: 5
19
+ timeout: 60
20
+ screen: 1280/1024
21
+ screenwidth: 1280
22
+ screenheight: 1024
23
+ position: 0/0
24
+ xposition: 0
25
+ yposition: 0
26
+ highlight: true
27
+ defaults: ['--format html', '--out coverage/report.html', '-P -s']
7
28
 
8
29
  test_task1:
9
30
  feature_order: ['features/featureOne', 'features/featureTwo', 'features/featureThree']
10
31
  runtime_defaults:
11
32
  environment: 'release'
12
33
  log_level: 'debug'
13
- defaults: ['--format html', '--out coverage/report.html', '--format pretty', '-P -s']
34
+ defaults: ['--format html', '--out coverage/report.html', '-P -s']
14
35
 
15
- no_runtime_defaults:
16
- feature_order: ['features/featureOne', 'features/featureTwo', 'features/featureThree']
17
- defaults: ['--format html', '--out coverage/report.html', '--format pretty', '-P -s']
36
+ no_defaults:
37
+ feature_order: ['features/featureOne', 'features/featureTwo', 'features/featureThree']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cukesparse
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Chrisp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-04 00:00:00.000000000 Z
11
+ date: 2013-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: 1.3.1
75
+ version: 1.3.2
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ~>
81
81
  - !ruby/object:Gem::Version
82
- version: 1.3.1
82
+ version: 1.3.2
83
83
  description: A simple command line parser to pass arguments into Cucumber
84
84
  email: jonathan.chrisp@gmail.com
85
85
  executables:
@@ -95,6 +95,7 @@ files:
95
95
  - config/tasks.yml
96
96
  - cukesparse.gemspec
97
97
  - lib/cukesparse.rb
98
+ - report.html
98
99
  - spec/cukesparse_spec.rb
99
100
  - spec/spec_files/invalid_tasks.yml
100
101
  - spec/spec_files/valid_tasks.yml
@@ -108,12 +109,12 @@ require_paths:
108
109
  - lib
109
110
  required_ruby_version: !ruby/object:Gem::Requirement
110
111
  requirements:
111
- - - '>='
112
+ - - ! '>='
112
113
  - !ruby/object:Gem::Version
113
114
  version: 1.9.2
114
115
  required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  requirements:
116
- - - '>='
117
+ - - ! '>='
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []