cspec 0.2.4 → 0.2.7

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
  SHA256:
3
- metadata.gz: 4de36af904dcb6411a59838e1ed2f415bbf82103db8bdaad599c6be4f3afc5e1
4
- data.tar.gz: 19da5e138539e167c6084040eea3c1ef5e165e833d56e2cc0e15960f24c824d8
3
+ metadata.gz: 37f5f6e0df55477bdae0f6536656d20887381940916f820469ac28f6743146f8
4
+ data.tar.gz: 7e0de0d51f8af19e40290f8e6fdf7ace494c7ea8f0c1151df13415ee22a52b96
5
5
  SHA512:
6
- metadata.gz: 558cad6ce6e23b6519c3d78cf518c4d49d6554e680ca9a7cfc5187eaa1eab52a57a5c386e23b2b6ebc6844feb55cb8dd24e1f87c97af262c0430aece81683a9b
7
- data.tar.gz: 2a31cc1c832f7e65fedacb7047a6e178065ff3675ddf5e190bb31f6c20f60135d036df8c1cec5376bae044e2be3dbbe7d7845697cd607417e34eeea6778bd787
6
+ metadata.gz: e18e98d574800854437069aa7676f5404e90ef43f6f32958010b47f000b2480d6b90edea9058041ae4417a4569b3bc2eaa313cd14bf069dc8ef7ed26bc23daa8
7
+ data.tar.gz: 14aa6812e2872eae093e3ca5107cb5d09515bddbee07162e51d4d69a9f79f19bcc8274dee4aa617fb73065e7aeb6d9d60392b90d6c4a17c22e494235859ae03e
data/Gemfile.lock CHANGED
@@ -1,12 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cspec (0.2.3)
4
+ cspec (0.2.6)
5
+ colorize (~> 0.8.1)
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
9
10
  coderay (1.1.3)
11
+ colorize (0.8.1)
10
12
  diff-lcs (1.5.0)
11
13
  docile (1.4.0)
12
14
  method_source (1.0.0)
data/cspec.gemspec CHANGED
@@ -38,6 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
39
39
  spec.require_paths = ['lib']
40
40
 
41
+ spec.add_dependency 'colorize', '~> 0.8.1'
41
42
  spec.add_development_dependency 'bundler', '~> 1.17'
42
43
  spec.add_development_dependency 'pry'
43
44
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -1,7 +1,9 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- cspec (0.2.3)
4
+ colorize (0.8.1)
5
+ cspec (0.2.6)
6
+ colorize (~> 0.8.1)
5
7
 
6
8
  PLATFORMS
7
9
  ruby
@@ -29,5 +29,5 @@ class Calculator
29
29
  end
30
30
 
31
31
  result = CSpec::Runner.run!("#{Dir.pwd}/specs.csv")
32
- puts "Success: #{result}"
32
+
33
33
  exit result ? 0 : 1
@@ -3,4 +3,4 @@ MyClass,my test,instance,greet,Bob,Jones,,"Hello, Bob Jones"
3
3
  Calculator,another test,class,add,1,2,,3
4
4
  Calculator,another test,class,multi_subtract,6,2,1,3
5
5
  Util,another test,instance,build_array,6,2,1,"[6, 2, 1]"
6
- Util,another test,instance,sum_array,"[6, 2, 1]",,,9
6
+ Util,another test,instance,sum_array,"[6, 2, 1]",,,91
@@ -1,7 +1,9 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- cspec (0.2.3)
4
+ colorize (0.8.1)
5
+ cspec (0.2.6)
6
+ colorize (~> 0.8.1)
5
7
 
6
8
  PLATFORMS
7
9
  ruby
@@ -13,5 +13,4 @@ class MyClass
13
13
  end
14
14
 
15
15
  result = CSpec::Runner.run!("#{Dir.pwd}/specs.csv")
16
- puts "Success: #{result}"
17
16
  exit result ? 0 : 1
@@ -1,7 +1,9 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- cspec (0.2.3)
4
+ colorize (0.8.1)
5
+ cspec (0.2.6)
6
+ colorize (~> 0.8.1)
5
7
 
6
8
  PLATFORMS
7
9
  ruby
@@ -13,5 +13,4 @@ class MyClass
13
13
  end
14
14
 
15
15
  result = CSpec::Runner.run!("#{Dir.pwd}/specs.csv")
16
- puts "Success: #{result}"
17
16
  exit result ? 0 : 1
@@ -1,7 +1,9 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- cspec (0.2.1)
4
+ colorize (0.8.1)
5
+ cspec (0.2.6)
6
+ colorize (~> 0.8.1)
5
7
 
6
8
  PLATFORMS
7
9
  ruby
@@ -9,5 +9,4 @@ class MyClass
9
9
  end
10
10
 
11
11
  result = CSpec::Runner.run!("#{Dir.pwd}/specs.csv")
12
- puts "Success: #{result}"
13
12
  exit result ? 0 : 1
@@ -3,9 +3,7 @@
3
3
  module CSpec
4
4
  module ResultsOutputter
5
5
  def self.display(results)
6
- results.each do |r|
7
- puts r
8
- end
6
+ results.filter { |r| !r.error.nil? }.map(&:to_s).join("\n")
9
7
  end
10
8
  end
11
9
  end
data/lib/cspec/runner.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'colorize'
4
+
3
5
  module CSpec
4
6
  module Runner
5
7
  def self.run!(filepath)
@@ -8,14 +10,20 @@ module CSpec
8
10
  specs = Loader.load(filepath)
9
11
  return false if process_errors(::CSpec::Validator.validate_specs(specs))
10
12
 
11
- results = run(specs)
13
+ success = CSpec::Result.success?(results = run(specs))
12
14
 
13
- return true if CSpec::Result.success?(results)
15
+ present_result(success, results)
16
+ end
14
17
 
15
- puts results.inspect
16
- puts '#######################'
17
- ResultsOutputter.display(results)
18
- false
18
+ def self.present_result(success, results)
19
+ if success
20
+ puts 'Success'.green
21
+ true
22
+ else
23
+ puts 'Failure'.red
24
+ puts ResultsOutputter.display(results).red
25
+ false
26
+ end
19
27
  end
20
28
 
21
29
  def self.run(specs)
data/lib/cspec/spec.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'pry'
4
3
  module CSpec
5
4
  class Spec
6
5
  attr_reader :class,
@@ -22,12 +21,12 @@ module CSpec
22
21
  end
23
22
 
24
23
  def ==(other)
25
- name == other.name &&
26
- self.class == other.class &&
27
- method == other.method &&
28
- type == other.type &&
29
- method_args == other.method_args &&
30
- initialization_args == other.initialization_args
24
+ name == other&.name &&
25
+ self.class == other&.class &&
26
+ method == other&.method &&
27
+ type == other&.type &&
28
+ method_args == other&.method_args &&
29
+ initialization_args == other&.initialization_args
31
30
  end
32
31
 
33
32
  def error
data/lib/cspec/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CSpec
4
- VERSION = '0.2.4'
4
+ VERSION = '0.2.7'
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarrod Folino
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-15 00:00:00.000000000 Z
11
+ date: 2022-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colorize
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.8.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement