cspec 0.2.5 → 0.2.8

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: e945a9ed7c6719e928f54888ed3f02daaf6bf5c28dc95af9beb2a2654299a430
4
- data.tar.gz: a91fd779859320fd456701ddf76190b75f322f2cdca9b5cc793c559985566a14
3
+ metadata.gz: d77748862bc561faec18dbdf8fe81e4d36a3aba73c8f407727227c1ff425225b
4
+ data.tar.gz: 6469311b41f6791ca6ef1d8f624a28e527fce93e4f5e6ed14ffefe95fb5164de
5
5
  SHA512:
6
- metadata.gz: 21e1a98df561d385c1e44b284760f3c5e8b7abe61506197824d5e5a2513421aee4e8d3a74d39323aa606d55d5048980ab67688d7e3216a3d325ea41decc8f316
7
- data.tar.gz: e07ae95020f5c8aa7674255f37f6ca02f6350e8bf0400907a45f185323438011fb024ca0fb9c985a5769d22a86db13547c4bc539ec60946205f2b785ac85fb1a
6
+ metadata.gz: 9af5fb2b70cece31594e123af832aca72ee88cc145b7df360e5df9727caef9651322c050f3a625341b0f9a11a5cc318f44477991f4ed81d4026c494367a215d4
7
+ data.tar.gz: e05c4831dc228f6a5c28780690407d14265400e8d6d088027e1e28a4d2f92ada599f70762ef19afcbb15439f507860680334295a44fdd737427744d3eb81d815
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.8)
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/bin/cspec ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'fileutils'
6
+ require 'cspec'
7
+
8
+ USAGE = "\n Usage:\n\n cspec template list\n cspec generate <template name>\n"
9
+
10
+ command = ARGV[0]
11
+ sub_command = ARGV[1]
12
+
13
+ case command
14
+ when 'template'
15
+ if sub_command == 'list'
16
+ dir = File.join(CSpec.root, 'examples')
17
+ Dir.chdir(dir)
18
+ result = Dir.glob('*').select do |f|
19
+ File.directory?(f)
20
+ end
21
+ puts result
22
+ end
23
+ when 'generate'
24
+ puts "Generating from template: #{sub_command}"
25
+ example_dir = File.join(CSpec.root, 'examples', sub_command)
26
+ FileUtils.cp_r(example_dir, '.')
27
+ puts "cd into the #{sub_command} directory"
28
+ else
29
+ puts USAGE
30
+ end
data/cspec.gemspec CHANGED
@@ -34,10 +34,12 @@ Gem::Specification.new do |spec|
34
34
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
35
35
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
36
36
  end
37
- spec.bindir = 'exe'
38
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.bindir = 'bin'
38
+ # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
39
+ spec.executables << 'cspec'
39
40
  spec.require_paths = ['lib']
40
41
 
42
+ spec.add_dependency 'colorize', '~> 0.8.1'
41
43
  spec.add_development_dependency 'bundler', '~> 1.17'
42
44
  spec.add_development_dependency 'pry'
43
45
  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.4)
4
+ colorize (0.8.1)
5
+ cspec (0.2.7)
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
@@ -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.7)
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.7)
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.7)
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.reject { |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
@@ -21,12 +21,12 @@ module CSpec
21
21
  end
22
22
 
23
23
  def ==(other)
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
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
30
30
  end
31
31
 
32
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.5'
4
+ VERSION = '0.2.8'
5
5
  end
data/lib/cspec.rb CHANGED
@@ -12,4 +12,7 @@ require 'cspec/results_outputter'
12
12
  require 'csv'
13
13
 
14
14
  module CSpec
15
+ def self.root
16
+ File.dirname __dir__
17
+ end
15
18
  end
@@ -0,0 +1,10 @@
1
+ bundle update
2
+ WORK_DIR=`pwd`
3
+ cd "$WORK_DIR/examples/advance"
4
+ bundle update
5
+ cd "$WORK_DIR/examples/basic"
6
+ bundle update
7
+ cd "$WORK_DIR/examples/class_methods"
8
+ bundle update
9
+ cd "$WORK_DIR/examples/method_args"
10
+ bundle update
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.5
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarrod Folino
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-15 00:00:00.000000000 Z
11
+ date: 2022-03-17 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
@@ -83,7 +97,8 @@ dependencies:
83
97
  description: A testing framework to run unit tests via csv
84
98
  email:
85
99
  - jarrod.folino@coderacademy.edu.au
86
- executables: []
100
+ executables:
101
+ - cspec
87
102
  extensions: []
88
103
  extra_rdoc_files: []
89
104
  files:
@@ -99,6 +114,7 @@ files:
99
114
  - README.md
100
115
  - Rakefile
101
116
  - bin/console
117
+ - bin/cspec
102
118
  - bin/setup
103
119
  - cspec.gemspec
104
120
  - examples/advance/Gemfile
@@ -127,6 +143,7 @@ files:
127
143
  - lib/cspec/spec.rb
128
144
  - lib/cspec/validator.rb
129
145
  - lib/cspec/version.rb
146
+ - update_examples.sh
130
147
  homepage: https://github.com/jarroddalefolino/cspec
131
148
  licenses:
132
149
  - MIT