cukesparse 2.1.2 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e1c5631d7061d687b6d4b1e901c2c1111b31969
4
- data.tar.gz: 768ac84138f4293f5b431d41a06fb5d31ce8b211
3
+ metadata.gz: 6fd27ef84ae23d3d860b76f2d1396d8a656a48ae
4
+ data.tar.gz: cc5b59bd1528cbda1397ae59eff8615d4100cc87
5
5
  SHA512:
6
- metadata.gz: 09cd6de2a10c724c88b54db226f01ae15ada3f757d72c2a9f7fa3ad2705043fe64498ea66c1760a3c38e395cf6a9a805cef2ad1acbf417b56f8e71cc85d8693d
7
- data.tar.gz: 9fe5ee78c9a63f5dbaf2ff572b92e8b8c860f82d17fca690c95511f24ff013484c33099a0fe51756f0a849e9232771602777543cecfe47da44d144a31b483088
6
+ metadata.gz: 25c3bf3de697c310ccc693662336beeb4dc1a3ba165eac7f6b0a35c9aa8b0ba9fb099e71dfcfa4000ec5dfa9eda3f4768868b84f023c5f39e5321e9c88ac32ab
7
+ data.tar.gz: 223e76368a8df207a7b258840a0e0e8896d5bcc2593e1ab00bb4e96f543e814aaa833ddc99557187c2f1a986fc4f4556448ee4d27f3e7c0b2f1e126c46bce68a
data/.gitignore CHANGED
@@ -19,4 +19,8 @@ report.html
19
19
  # YARD artifacts
20
20
  .yardoc
21
21
  _yardoc
22
- doc/
22
+ doc/
23
+
24
+ # Testing Folders
25
+ config/
26
+ features/
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
- source "http://rubygems.org"
1
+ source 'http://rubygems.org'
2
2
 
3
- gem 'bundler', '~> 1.3.4'
4
- gem "coveralls", "~> 0.6.7", require: false
3
+ gem 'coveralls', '~> 0.6.7', require: false
4
+ gem 'simplecov'
5
+ gem 'pry'
5
6
 
6
7
  gemspec
@@ -4,7 +4,4 @@ require 'cukesparse'
4
4
  begin
5
5
  Cukesparse.reset!
6
6
  Cukesparse.execute
7
- rescue Interrupt
8
- exit!
9
- Process.kill('INT', -Process.getpgrp)
10
7
  end
@@ -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-09-17'
6
+ s.date = '2013-09-19'
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'
@@ -13,7 +13,6 @@ Gem::Specification.new do |s|
13
13
  s.required_ruby_version = ">= 1.9.2"
14
14
 
15
15
  s.add_development_dependency 'rspec', '~> 2.13.0'
16
- s.add_development_dependency 'pry', '~> 0.9.12.2'
17
16
 
18
17
  s.add_runtime_dependency 'clik', '~> 0.1.0'
19
18
  s.add_runtime_dependency 'colored', '~> 1.2'
@@ -2,7 +2,6 @@ require 'clik'
2
2
  require 'colored'
3
3
  require 'yaml'
4
4
 
5
-
6
5
  module Cukesparse
7
6
  class << self
8
7
  attr_accessor :config_file, :config, :task, :parameters, :command
@@ -54,13 +53,14 @@ module Cukesparse
54
53
  end
55
54
 
56
55
  return debug if @parameters.has_key? 'debug'
57
- system @command.join(' ')
58
- exit $?.exitstatus
56
+ return system(@command.join(' '))
59
57
  end
60
58
 
61
59
  # Checks for task in arguments
62
60
  def check_for_task
61
+ return abort 'ERROR: Your tasks.yml file is empty!'.red.underline unless @config
63
62
  task = argv & @config.keys
63
+
64
64
  return abort 'ERROR: No task was passed to cukesparse!'.red.underline if task.empty?
65
65
  return puts 'WARN: Multiple tasks have been passed!'.yellow if task.length > 1
66
66
  return @task = @config[task[0]]
@@ -1,3 +1,3 @@
1
1
  module Cukesparse
2
- VERSION = "2.1.2"
2
+ VERSION = "2.1.5"
3
3
  end
@@ -0,0 +1,51 @@
1
+ require 'helper'
2
+
3
+ describe '.build_command' do
4
+ before :each do
5
+ ARGV.clear
6
+ Cukesparse.reset!
7
+ end
8
+
9
+ context "when run with valid task defined" do
10
+ it "will build the appropriate command" do
11
+ ARGV.push('test_task', '-t', 'test')
12
+ Cukesparse.config_file = File.join(fixture_path, 'valid_tasks.yml')
13
+ Cukesparse.load_config
14
+ Cukesparse.parse_argv
15
+ Cukesparse.check_for_task
16
+ Cukesparse.check_for_parameters
17
+ Cukesparse.set_cucumber_defaults
18
+ Cukesparse.set_runtime_defaults
19
+
20
+ #Check command array
21
+ Cukesparse.command.should_receive(:push).with('bundle exec cucumber').and_call_original
22
+ Cukesparse.command.should_receive(:push).with('--require features/').and_call_original
23
+ Cukesparse.command.should_receive(:push).with('features/featureOne features/featureTwo features/featureThree').and_call_original
24
+ Cukesparse.command.should_receive(:push).with('--format pretty').and_call_original
25
+ Cukesparse.command.should_receive(:push).with(["--name feature1", "--name feature2"]).and_call_original
26
+ Cukesparse.command.should_receive(:push).with(["--tags test", "--tags tags1", "--tags tags2"]).and_call_original
27
+ Cukesparse.command.should_receive(:push).with("--strict").and_call_original
28
+ Cukesparse.command.should_receive(:push).with("--verbose").and_call_original
29
+ Cukesparse.command.should_receive(:push).with("--dry-run").and_call_original
30
+ Cukesparse.command.should_receive(:push).with("--guess").and_call_original
31
+ Cukesparse.command.should_receive(:push).with("--expand").and_call_original
32
+ Cukesparse.command.should_receive(:push).with("ENVIRONMENT=release").and_call_original
33
+ Cukesparse.command.should_receive(:push).with("LOG_LEVEL=debug").and_call_original
34
+ Cukesparse.command.should_receive(:push).with("CLEANUP=true").and_call_original
35
+ Cukesparse.command.should_receive(:push).with("DATABASE=true").and_call_original
36
+ Cukesparse.command.should_receive(:push).with("JENKINS=true").and_call_original
37
+ Cukesparse.command.should_receive(:push).with("RETRIES=5").and_call_original
38
+ Cukesparse.command.should_receive(:push).with("TIMEOUT=60").and_call_original
39
+ Cukesparse.command.should_receive(:push).with("SCREENWIDTH=1280").and_call_original
40
+ Cukesparse.command.should_receive(:push).with("SCREENHEIGHT=1024").and_call_original
41
+ Cukesparse.command.should_receive(:push).with("XPOSITION=0").and_call_original
42
+ Cukesparse.command.should_receive(:push).with("YPOSITION=0").and_call_original
43
+ Cukesparse.command.should_receive(:push).with("HIGHLIGHT=true").and_call_original
44
+ Cukesparse.command.should_receive(:push).with("--format html --out coverage/report.html -P -s").and_call_original
45
+
46
+ Cukesparse.should_receive(:system).with('bundle exec cucumber --require features/ features/featureOne features/featureTwo features/featureThree --tags test --tags tags1 --tags tags2 --format pretty --name feature1 --name feature2 --strict --verbose --dry-run --guess --expand ENVIRONMENT=release LOG_LEVEL=debug CLEANUP=true DATABASE=true JENKINS=true RETRIES=5 TIMEOUT=60 SCREENWIDTH=1280 SCREENHEIGHT=1024 XPOSITION=0 YPOSITION=0 HIGHLIGHT=true --format html --out coverage/report.html -P -s').and_return(true)
47
+ Cukesparse.build_command
48
+ end
49
+
50
+ end
51
+ end
@@ -8,7 +8,7 @@ describe '.check_for_parameters' do
8
8
 
9
9
  context "when run with no paramaters defined" do
10
10
  it "will return an warning if no parameters are provided" do
11
- Cukesparse.should_receive("puts").with("\e[0;33;49mWARN: No parameters passed to cukesparse\e[0m")
11
+ Cukesparse.should_receive("puts").with("WARN: No parameters passed to cukesparse".yellow)
12
12
  Cukesparse.check_for_parameters
13
13
  end
14
14
  end
@@ -6,10 +6,20 @@ describe '.check_for_task' do
6
6
  Cukesparse.reset!
7
7
  end
8
8
 
9
+ context "when run with task defined and empty config file" do
10
+ it "will return an error if config is empty" do
11
+ ARGV.push('test_task')
12
+ Cukesparse.config_file = File.join(fixture_path, 'empty_tasks.yml')
13
+ Cukesparse.load_config
14
+ Cukesparse.should_receive("abort").with("ERROR: Your tasks.yml file is empty!".red.underline)
15
+ Cukesparse.check_for_task
16
+ end
17
+ end
18
+
9
19
  context "when run with no task defined" do
10
20
  it "will return an error if no task is provided" do
11
21
  ARGV.push('incorrect_task')
12
- Cukesparse.should_receive("abort").with("\e[4;31;49mERROR: No task was passed to cukesparse!\e[0m")
22
+ Cukesparse.should_receive("abort").with("ERROR: No task was passed to cukesparse!".red.underline)
13
23
  Cukesparse.check_for_task
14
24
  end
15
25
  end
@@ -19,7 +29,7 @@ describe '.check_for_task' do
19
29
  ARGV.push('test_task', 'test_task1')
20
30
  Cukesparse.config_file = File.join(fixture_path, 'valid_tasks.yml')
21
31
  Cukesparse.load_config
22
- Cukesparse.should_receive("puts").with("\e[0;33;49mWARN: Multiple tasks have been passed!\e[0m")
32
+ Cukesparse.should_receive("puts").with("WARN: Multiple tasks have been passed!".yellow)
23
33
  Cukesparse.check_for_task
24
34
  end
25
35
  end
@@ -10,13 +10,13 @@ describe '.debug' do
10
10
  it "will return the correct output" do
11
11
  ARGV.push('test_task1', '--debug')
12
12
  Cukesparse.config_file = File.join(fixture_path, 'valid_tasks.yml')
13
- Cukesparse.should_receive("puts").with("\e[0;33;49mDEBUG: Outputting ARGV passed\e[0m")
13
+ Cukesparse.should_receive("puts").with("DEBUG: Outputting ARGV passed".yellow)
14
14
  Cukesparse.should_receive("puts").with("[\"test_task1\", \"--debug\"]")
15
- Cukesparse.should_receive("puts").with("\e[0;33;49mDEBUG: Outputting parsed config file\e[0m")
15
+ Cukesparse.should_receive("puts").with("DEBUG: Outputting parsed config file".yellow)
16
16
  Cukesparse.should_receive("puts").with("{\"test_task\"=>{\"feature_order\"=>[\"features/featureOne\", \"features/featureTwo\", \"features/featureThree\"], \"cucumber_defaults\"=>{\"format\"=>\"pretty\", \"name\"=>[\"feature1\", \"feature2\"], \"tags\"=>[\"tags1\", \"tags2\"], \"strict\"=>true, \"verbose\"=>true, \"dry_run\"=>true, \"guess\"=>true, \"expand\"=>true}, \"runtime_defaults\"=>{\"environment\"=>\"release\", \"log_level\"=>\"debug\", \"cleanup\"=>true, \"database\"=>true, \"jenkins\"=>true, \"retries\"=>5, \"timeout\"=>60, \"screen\"=>\"1280/1024\", \"screenwidth\"=>1280, \"screenheight\"=>1024, \"position\"=>\"0/0\", \"xposition\"=>0, \"yposition\"=>0, \"highlight\"=>true}, \"defaults\"=>[\"--format html\", \"--out coverage/report.html\", \"-P -s\"]}, \"test_task1\"=>{\"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\"]}, \"cucumber_default_unknown\"=>{\"feature_order\"=>[\"features/featureOne\", \"features/featureTwo\", \"features/featureThree\"], \"cucumber_defaults\"=>{\"testing\"=>\"pretty\"}, \"runtime_defaults\"=>{\"environment\"=>\"release\", \"log_level\"=>\"debug\"}, \"defaults\"=>[\"--format html\", \"--out coverage/report.html\", \"-P -s\"]}, \"no_defaults\"=>{\"feature_order\"=>[\"features/featureOne\", \"features/featureTwo\", \"features/featureThree\"]}}")
17
- Cukesparse.should_receive("puts").with("\e[0;33;49mDEBUG: Outputting parameters created\e[0m")
17
+ Cukesparse.should_receive("puts").with("DEBUG: Outputting parameters created".yellow)
18
18
  Cukesparse.should_receive("puts").with("{\"debug\"=>\"DEBUG=TRUE\", \"format\"=>\"--format pretty\", \"environment\"=>\"ENVIRONMENT=release\", \"log_level\"=>\"LOG_LEVEL=debug\"}")
19
- Cukesparse.should_receive("puts").with("\e[0;33;49mDEBUG: Outputting command created\e[0m")
19
+ Cukesparse.should_receive("puts").with("DEBUG: Outputting command created".yellow)
20
20
  Cukesparse.should_receive("puts").with("bundle exec cucumber --require features/ features/featureOne features/featureTwo features/featureThree DEBUG=TRUE --format pretty ENVIRONMENT=release LOG_LEVEL=debug --format html --out coverage/report.html -P -s")
21
21
  Cukesparse.execute
22
22
  end
@@ -8,7 +8,7 @@ describe '.execute' do
8
8
 
9
9
  context "when run with no arguments" do
10
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")
11
+ Cukesparse.should_receive("puts").with("Cukesparse - a simple command line parser to pass arguments into Cucumber!".yellow)
12
12
  Cukesparse.execute
13
13
  end
14
14
  end
@@ -17,7 +17,7 @@ describe '.execute' do
17
17
  it "should display the tasks within the config file" do
18
18
  Cukesparse.config_file = File.join(fixture_path, 'valid_tasks.yml')
19
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, cucumber_default_unknown, no_defaults\e[0m")
20
+ Cukesparse.should_receive("puts").with("You have the following tasks within your config file: test_task, test_task1, cucumber_default_unknown, no_defaults".yellow)
21
21
  Cukesparse.execute
22
22
  end
23
23
  end
@@ -9,7 +9,7 @@ describe '.load_config' do
9
9
  context "when run with incorrect task file" do
10
10
  it "will return an error if the task file fails to parse" do
11
11
  Cukesparse.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")
12
+ Cukesparse.should_receive("abort").with("Your tasks file did not parse as expected!".red.underline)
13
13
  Cukesparse.load_config
14
14
  end
15
15
  end
@@ -17,7 +17,7 @@ describe '.load_config' do
17
17
  context "when run with task file missing" do
18
18
  it "will return an error if the task file is missing" do
19
19
  Cukesparse.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")
20
+ Cukesparse.should_receive("abort").with("Your tasks file is missing!".red.underline)
21
21
  Cukesparse.load_config
22
22
  end
23
23
  end
@@ -9,7 +9,7 @@ describe '.parse_argv' do
9
9
  context "when run with incorrect ARGV array" do
10
10
  it "will return an error if arguments are nil" do
11
11
  ARGV.push(nil)
12
- Cukesparse.should_receive("abort").with("\e[4;31;49mError processing passed CLI arguments!\e[0m")
12
+ Cukesparse.should_receive("abort").with("Error processing passed CLI arguments!".red.underline)
13
13
  Cukesparse.parse_argv
14
14
  end
15
15
  end
@@ -12,7 +12,7 @@ describe '.set_cucumber_defaults' do
12
12
  Cukesparse.config_file = File.join(fixture_path, 'valid_tasks.yml')
13
13
  Cukesparse.load_config
14
14
  Cukesparse.check_for_task
15
- Cukesparse.should_receive("puts").with("\e[0;33;49mWARN: The task has no cucumber defaults!\e[0m")
15
+ Cukesparse.should_receive("puts").with("WARN: The task has no cucumber defaults!".yellow)
16
16
  Cukesparse.set_cucumber_defaults
17
17
  end
18
18
  end
@@ -25,7 +25,7 @@ describe '.set_cucumber_defaults' do
25
25
  Cukesparse.parse_argv
26
26
  Cukesparse.check_for_task
27
27
  Cukesparse.check_for_parameters
28
- Cukesparse.should_receive("puts").with("\e[0;33;49mWARN: The cucumber default testing isn't a known option!\e[0m")
28
+ Cukesparse.should_receive("puts").with("WARN: The cucumber default testing isn't a known option!".yellow)
29
29
  Cukesparse.set_cucumber_defaults
30
30
  end
31
31
  end
@@ -12,7 +12,7 @@ describe '.set_runtime_defaults' do
12
12
  Cukesparse.config_file = File.join(fixture_path, 'valid_tasks.yml')
13
13
  Cukesparse.load_config
14
14
  Cukesparse.check_for_task
15
- Cukesparse.should_receive("puts").with("\e[0;33;49mWARN: The task has no runtime defaults!\e[0m")
15
+ Cukesparse.should_receive("puts").with("WARN: The task has no runtime defaults!".yellow)
16
16
  Cukesparse.set_runtime_defaults
17
17
  end
18
18
  end
@@ -28,14 +28,14 @@ describe '.split_parameters' do
28
28
 
29
29
  context "when run with one argument" do
30
30
  it "will return a you have passed enough parameters error" do
31
- Cukesparse.should_receive("abort").with("\e[4;31;49mERROR: You have not passed enough parameters in the test command line argument!\e[0m")
31
+ Cukesparse.should_receive("abort").with("ERROR: You have not passed enough parameters in the test command line argument!".red.underline)
32
32
  Cukesparse.split_parameters('1024', 'test')
33
33
  end
34
34
  end
35
35
 
36
36
  context "when run with over two argument" do
37
37
  it "will return a you have passed to many parameters error" do
38
- Cukesparse.should_receive("abort").with("\e[4;31;49mERROR: You have passed to many parameters in the test command line argument!\e[0m")
38
+ Cukesparse.should_receive("abort").with("ERROR: You have passed to many parameters in the test command line argument!".red.underline)
39
39
  Cukesparse.split_parameters('1024/1280/16', 'test')
40
40
  end
41
41
  end
File without changes
@@ -1,6 +1,13 @@
1
+ require 'simplecov'
1
2
  require 'coveralls'
3
+ require 'colored'
2
4
 
3
- Coveralls.wear!
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
+ Coveralls::SimpleCov::Formatter,
7
+ SimpleCov::Formatter::HTMLFormatter,
8
+ ]
9
+
10
+ SimpleCov.start
4
11
  require 'cukesparse'
5
12
 
6
13
  RSpec.configure do |config|
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: 2.1.2
4
+ version: 2.1.5
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-09-17 00:00:00.000000000 Z
11
+ date: 2013-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.13.0
27
- - !ruby/object:Gem::Dependency
28
- name: pry
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: 0.9.12.2
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: 0.9.12.2
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: clik
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -98,6 +84,7 @@ files:
98
84
  - lib/cukesparse/version.rb
99
85
  - spec/cukesparse/add_multiple_spec.rb
100
86
  - spec/cukesparse/argv_spec.rb
87
+ - spec/cukesparse/build_command_spec.rb
101
88
  - spec/cukesparse/check_for_parameters_spec.rb
102
89
  - spec/cukesparse/check_for_task_spec.rb
103
90
  - spec/cukesparse/debug_spec.rb
@@ -109,6 +96,7 @@ files:
109
96
  - spec/cukesparse/set_runtime_defaults_spec.rb
110
97
  - spec/cukesparse/split_parameters_spec.rb
111
98
  - spec/cukesparse_spec.rb
99
+ - spec/fixtures/empty_tasks.yml
112
100
  - spec/fixtures/invalid_tasks.yml
113
101
  - spec/fixtures/valid_tasks.yml
114
102
  - spec/helper.rb
@@ -139,6 +127,7 @@ summary: Cukesparse - cucumber command line parser
139
127
  test_files:
140
128
  - spec/cukesparse/add_multiple_spec.rb
141
129
  - spec/cukesparse/argv_spec.rb
130
+ - spec/cukesparse/build_command_spec.rb
142
131
  - spec/cukesparse/check_for_parameters_spec.rb
143
132
  - spec/cukesparse/check_for_task_spec.rb
144
133
  - spec/cukesparse/debug_spec.rb
@@ -150,6 +139,7 @@ test_files:
150
139
  - spec/cukesparse/set_runtime_defaults_spec.rb
151
140
  - spec/cukesparse/split_parameters_spec.rb
152
141
  - spec/cukesparse_spec.rb
142
+ - spec/fixtures/empty_tasks.yml
153
143
  - spec/fixtures/invalid_tasks.yml
154
144
  - spec/fixtures/valid_tasks.yml
155
145
  - spec/helper.rb