cspec 0.1.3 → 0.2.0

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: 0e6512690d45aa69b0fd226cb3cbca981c05b5f162abee524553e5f91aefa6d3
4
- data.tar.gz: 86de0ecc3c9ef516fb6826982bd0688dade55354d487a35670df4e868ea99098
3
+ metadata.gz: cda46241abf4da89965884153263bde46dca2f2861f260797ae0d7e0dd9112f5
4
+ data.tar.gz: c313da5f4b11eba2dc9f666d39377ae2c5d53780dfbf3a7521c97b16d02cd8d0
5
5
  SHA512:
6
- metadata.gz: ecf7e5dbce6382722a9cf26bef10c8d75a940d797dc6ddc23c971131084321a2cc6aa3248a816ab0301fb16d5aef0e62980cc38ca5de7feea1341750719f59f6
7
- data.tar.gz: c2830c4864d15e6861948bf5bd1da88ca11066f676d82cbd0c47865a983cc7f1357c73e55db23551c0f08ef73915c5697ea953111c5c431ae777c824a1e3f54c
6
+ metadata.gz: a31c47d67801b6e6efd5e7ad7903e3bdec312c8df734e84768b27f707f6a89c3b0b14545c14d8450416afc3d331647fe209b3094652a68b690abb02405afcb30
7
+ data.tar.gz: 6132fb403d49a14b014ffeade47400dc2c2e1c95e207573e64d50acae0bdfcab40f7fe9e6e2891ae2b563a415bd818177c89a86dce4f97a286cad93efd9cdb7b
@@ -0,0 +1,48 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ main ]
13
+ pull_request:
14
+ branches: [ main ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.5', '2.6', '2.7', '3.0']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Install Rubocop
35
+ run: gem install rubocop
36
+ - name: Run Rubocop
37
+ run: rubocop
38
+ - name: Run Specs
39
+ run: bundle exec rspec
40
+ - name: Run Basic Example
41
+ working-directory: ./examples/basic
42
+ run: bundle install && bundle exec ruby myspec.rb
43
+ - name: Run Method Args Example
44
+ working-directory: ./examples/method_args
45
+ run: bundle install && bundle exec ruby myspec.rb
46
+ - name: Run Class Methods Example
47
+ working-directory: ./examples/class_methods
48
+ run: bundle install && bundle exec ruby myspec.rb
data/.rubocop.yml ADDED
@@ -0,0 +1,4 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ Style/Documentation:
4
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,12 @@
1
+ Metrics/BlockLength:
2
+ Max: 50
3
+
4
+ Metrics/MethodLength:
5
+ Max: 11
6
+
7
+ Metrics/ParameterLists:
8
+ Max: 6
9
+
10
+ Security/Eval:
11
+ Exclude:
12
+ - 'lib/cspec/data_type.rb'
data/Gemfile.lock CHANGED
@@ -1,12 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cspec (0.1.2)
4
+ cspec (0.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  diff-lcs (1.5.0)
10
+ docile (1.4.0)
10
11
  rake (10.5.0)
11
12
  rspec (3.11.0)
12
13
  rspec-core (~> 3.11.0)
@@ -21,6 +22,12 @@ GEM
21
22
  diff-lcs (>= 1.2.0, < 2.0)
22
23
  rspec-support (~> 3.11.0)
23
24
  rspec-support (3.11.0)
25
+ simplecov (0.21.2)
26
+ docile (~> 1.1)
27
+ simplecov-html (~> 0.11)
28
+ simplecov_json_formatter (~> 0.1)
29
+ simplecov-html (0.12.3)
30
+ simplecov_json_formatter (0.1.4)
24
31
 
25
32
  PLATFORMS
26
33
  ruby
@@ -30,6 +37,7 @@ DEPENDENCIES
30
37
  cspec!
31
38
  rake (~> 10.0)
32
39
  rspec (~> 3.0)
40
+ simplecov
33
41
 
34
42
  BUNDLED WITH
35
43
  1.17.2
data/cspec.gemspec CHANGED
@@ -5,6 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'cspec/version'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
+ spec.required_ruby_version = '>= 2.5.0'
8
9
  spec.name = 'cspec'
9
10
  spec.version = Cspec::VERSION
10
11
  spec.authors = ['Jarrod Folino']
@@ -40,4 +41,5 @@ Gem::Specification.new do |spec|
40
41
  spec.add_development_dependency 'bundler', '~> 1.17'
41
42
  spec.add_development_dependency 'rake', '~> 10.0'
42
43
  spec.add_development_dependency 'rspec', '~> 3.0'
44
+ spec.add_development_dependency 'simplecov'
43
45
  end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ gem 'cspec'
@@ -0,0 +1,13 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ cspec (0.1.4)
5
+
6
+ PLATFORMS
7
+ ruby
8
+
9
+ DEPENDENCIES
10
+ cspec
11
+
12
+ BUNDLED WITH
13
+ 1.17.2
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cspec'
4
+
5
+ class MyClass
6
+ def greet(fname, sname)
7
+ "Hello, #{fname} #{sname}"
8
+ end
9
+ end
10
+
11
+ result = CSpec::Runner.run!("#{Dir.pwd}/specs.csv")
12
+ puts "Success: #{result}"
13
+ exit result ? 0 : 1
@@ -0,0 +1,2 @@
1
+ class,name,type,method,method_arg_1,method_arg_2,expected
2
+ MyClass,my test,instance,greent,Bob,Jones,"Hello, Bo Jones"
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
- gem 'cspec'
4
+ gem 'cspec'
@@ -1,7 +1,7 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- cspec (0.1.2)
4
+ cspec (0.1.4)
5
5
 
6
6
  PLATFORMS
7
7
  ruby
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cspec'
2
4
 
3
5
  class MyClass
@@ -7,4 +9,5 @@ class MyClass
7
9
  end
8
10
 
9
11
  result = CSpec::Runner.run!("#{Dir.pwd}/specs.csv")
10
- puts "Success: #{result}"
12
+ puts "Success: #{result}"
13
+ exit result ? 0 : 1
@@ -1,2 +1,2 @@
1
- class,name,type,method,expected
2
- MyClass,my test,instance,hello,worldsds
1
+ class,name,type,method,method_args_1,expected
2
+ MyClass,my test,instance,hello,,world
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ gem 'cspec'
@@ -0,0 +1,13 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ cspec (0.1.4)
5
+
6
+ PLATFORMS
7
+ ruby
8
+
9
+ DEPENDENCIES
10
+ cspec
11
+
12
+ BUNDLED WITH
13
+ 1.17.2
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cspec'
4
+
5
+ class MyClass
6
+ def self.hello
7
+ 'world'
8
+ end
9
+
10
+ def self.say(name)
11
+ "Hello, #{name}"
12
+ end
13
+ end
14
+
15
+ result = CSpec::Runner.run!("#{Dir.pwd}/specs.csv")
16
+ puts "Success: #{result}"
17
+ exit result ? 0 : 1
@@ -0,0 +1,3 @@
1
+ class,name,type,method,method_args_1,expected
2
+ MyClass,my test,class,hello,,world
3
+ MyClass,my test,class,say,Bob,"Hello, Bob"
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ gem 'cspec'
@@ -0,0 +1,13 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ cspec (0.1.4)
5
+
6
+ PLATFORMS
7
+ ruby
8
+
9
+ DEPENDENCIES
10
+ cspec
11
+
12
+ BUNDLED WITH
13
+ 1.17.2
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cspec'
4
+
5
+ class MyClass
6
+ def greet(name)
7
+ "Hello, #{name}"
8
+ end
9
+ end
10
+
11
+ result = CSpec::Runner.run!("#{Dir.pwd}/specs.csv")
12
+ puts "Success: #{result}"
13
+ exit result ? 0 : 1
@@ -0,0 +1,2 @@
1
+ class,name,type,method,method_arg_1,expected
2
+ MyClass,my test,instance,greet,Bob,"Hello, Bob"
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CSpec
4
+ module CodeExec
5
+ def self.do_instance(spec)
6
+ class_under_test = Object.const_get(spec.class)
7
+ instance_under_test = class_under_test.new(*spec.initialization_args)
8
+ instance_under_test.send(spec.method, *spec.method_args)
9
+ end
10
+
11
+ def self.do_class(spec)
12
+ class_under_test = Object.const_get(spec.class)
13
+ class_under_test.send(spec.method, *spec.method_args)
14
+ end
15
+
16
+ def self.do(spec)
17
+ case spec.type
18
+ when 'class'
19
+ do_class(spec)
20
+ when 'instance'
21
+ do_instance(spec)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CSpec
4
+ module DataType
5
+ def self.convert_all(inputs)
6
+ return nil unless inputs
7
+
8
+ inputs.map { |input| convert(input) }
9
+ end
10
+
11
+ def self.convert(input)
12
+ return input unless input.instance_of?(String)
13
+
14
+ input = input.strip
15
+ return input.to_f if input =~ /^\d+\.\d+$/
16
+ return input.to_i if input =~ /^\d+$/
17
+ return eval(input) if input =~ /^\[.*\]$/
18
+ return nil if ['', nil, 'nil'].include?(input)
19
+
20
+ input.to_s
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'spec'
4
+
5
+ module CSpec
6
+ module Loader
7
+ def self.load(filename)
8
+ specs = ::CSV.open(filename, headers: :first_row).map(&:to_h)
9
+ specs.map { |spec| ::CSpec::Spec.new(process_args(spec)) }
10
+ end
11
+
12
+ def self.process_args(spec)
13
+ process_arg(spec, /method_arg_\d+/, 'method_args').merge(
14
+ process_arg(spec, /initialization_arg_\d+/, 'initialization_args')
15
+ )
16
+ end
17
+
18
+ def self.process_arg(spec, regex, aggregate_key)
19
+ spec.merge({
20
+ aggregate_key => spec.keys
21
+ .select { |k| k.match?(regex) }
22
+ .inject([]) { |values, key| values << spec[key] }
23
+ })
24
+ end
25
+
26
+ def self.validate(filename)
27
+ headers = CSV.open(filename, &:readline)
28
+ ::CSpec::Validator.validate(headers)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CSpec
4
+ class Result
5
+ attr_reader :spec, :error
6
+
7
+ def self.success?(results)
8
+ results.count { |r| !r.error.nil? }.zero?
9
+ end
10
+
11
+ def self.from_spec(spec, error = nil)
12
+ Result.new(spec, error)
13
+ end
14
+
15
+ def initialize(spec, error)
16
+ @spec = spec
17
+ @error = error
18
+ end
19
+
20
+ def ==(other)
21
+ error == other.error &&
22
+ spec == other.spec
23
+ end
24
+
25
+ def to_s
26
+ "spec: #{spec}\n" \
27
+ "error: #{error}"
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CSpec
4
+ module ResultsOutputter
5
+ def self.display(results)
6
+ results.each do |r|
7
+ puts r
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CSpec
4
+ module Runner
5
+ def self.run!(filepath)
6
+ errors = Loader.validate(filepath)
7
+ unless errors.empty?
8
+ puts errors
9
+ return false
10
+ end
11
+ specs = Loader.load(filepath)
12
+ results = run(specs)
13
+
14
+ return true if CSpec::Result.success?(results)
15
+
16
+ ResultsOutputter.display(results)
17
+ false
18
+ end
19
+
20
+ def self.run(specs)
21
+ specs.map do |spec|
22
+ result = ::CSpec::CodeExec.do(spec)
23
+ expected = ::CSpec::DataType.convert(spec.expected)
24
+ error_msg = "Expected #{spec.expected}, got: #{result}" if result != expected
25
+ Result.from_spec(spec, error_msg)
26
+ rescue StandardError => e
27
+ Result.from_spec(spec, e.inspect)
28
+ end
29
+ end
30
+ end
31
+ end
data/lib/cspec/spec.rb ADDED
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CSpec
4
+ class Spec
5
+ attr_reader :class,
6
+ :name,
7
+ :type,
8
+ :method,
9
+ :method_args,
10
+ :initialization_args,
11
+ :expected
12
+
13
+ def initialize(hash)
14
+ @class = hash['class']
15
+ @name = hash['name']
16
+ @type = hash['type']
17
+ @method = hash['method']
18
+ @method_args = ::CSpec::DataType.convert_all(hash['method_args'])
19
+ @initialization_args = ::CSpec::DataType.convert_all(hash['initialization_args'])
20
+ @expected = hash['expected']
21
+ end
22
+
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
30
+ end
31
+
32
+ def to_s
33
+ "name: #{name}, class: #{self.class}, method: #{method},"
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CSpec
4
+ module Validator
5
+ def self.validate(headers)
6
+ %w[class type name method expected].map do |required_header|
7
+ "Need header: #{required_header}" unless headers.include?(required_header)
8
+ end.reject(&:nil?)
9
+ end
10
+ end
11
+ end
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.1.3'
4
+ VERSION = '0.2.0'
5
5
  end
data/lib/cspec.rb CHANGED
@@ -1,101 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'cspec/version'
4
+ require 'cspec/runner'
5
+ require 'cspec/loader'
6
+ require 'cspec/result'
7
+ require 'cspec/code_exec'
8
+ require 'cspec/data_type'
9
+ require 'cspec/validator'
10
+ require 'cspec/results_outputter'
11
+
4
12
  require 'csv'
5
- require_relative 'result'
6
13
 
7
14
  module CSpec
8
- module ResultsOutputter
9
- def self.display(results)
10
- results.each do |r|
11
- puts r
12
- end
13
- end
14
- end
15
-
16
- module Loader
17
- def self.load(filename)
18
- ::CSV.open(filename, headers: :first_row).map(&:to_h)
19
- end
20
-
21
- def self.validate(filename)
22
- errors = []
23
- headers = CSV.open(filename, &:readline)
24
- %w[class type name method expected].each do |required_header|
25
- errors << "Need header: #{required_header}" unless headers.include?(required_header)
26
- end
27
- errors
28
- end
29
- end
30
-
31
- module Executer
32
- def self.do_instance(spec)
33
- class_under_test = Object.const_get(spec[:class])
34
- instance_under_test = class_under_test.new(*spec[:initialize_params])
35
- instance_under_test.send(spec[:method], *spec[:method_args])
36
- end
37
-
38
- def self.do_class(spec)
39
- class_under_test = Object.const_get(spec[:class])
40
- class_under_test.send(spec[:method], *spec[:method_args])
41
- end
42
- end
43
-
44
- module DataType
45
- def self.convert(input)
46
- if input =~ /^\d+\.\d+$/
47
- input.to_f
48
- elsif input =~ /^\d+$/
49
- input.to_i
50
- elsif input =~ /^\[.*\]$/
51
- eval(input)
52
- elsif ['', nil, 'nil'].include?(input)
53
- nil
54
- else
55
- input.to_s
56
- end
57
- end
58
- end
59
-
60
- module Runner
61
- def self.run!(filepath)
62
- errors = Loader.validate(filepath)
63
- if errors.size != 0
64
- puts errors
65
- return false
66
- end
67
- specs = Loader.load(filepath)
68
- results = run(specs)
69
-
70
- if CSpec::Result.success?(results)
71
- return true
72
- else
73
- ResultsOutputter.display(results)
74
- return false
75
- end
76
- end
77
-
78
- def self.run(specs)
79
- results = []
80
- specs.each do |spec|
81
- result = case spec[:type]
82
- when 'class'
83
- ::CSpec::Executer.do_class(spec)
84
- when 'instance'
85
- ::CSpec::Executer.do_instance(spec)
86
- end
87
-
88
- result = ::CSpec::DataType.convert(result)
89
- results << if result == ::CSpec::DataType.convert(spec[:expected])
90
- Result.new(spec['name'], spec['class'], spec['method'], nil, spec['description'], nil)
91
- else
92
- Result.new(spec['name'], spec['class'], spec['method'],
93
- "Expected #{spec[:expected]}, got: #{result}", spec['description'], nil)
94
- end
95
- rescue StandardError => e
96
- results << Result.new(spec[:name], spec[:class], spec[:method], e.inspect, spec[:description], nil)
97
- end
98
- results
99
- end
100
- end
101
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
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-02-27 00:00:00.000000000 Z
11
+ date: 2022-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: A testing framework to run unit tests via csv
56
70
  email:
57
71
  - jarrod.folino@coderacademy.edu.au
@@ -59,8 +73,11 @@ executables: []
59
73
  extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
76
+ - ".github/workflows/ruby.yml"
62
77
  - ".gitignore"
63
78
  - ".rspec"
79
+ - ".rubocop.yml"
80
+ - ".rubocop_todo.yml"
64
81
  - CODE_OF_CONDUCT.md
65
82
  - Gemfile
66
83
  - Gemfile.lock
@@ -70,13 +87,32 @@ files:
70
87
  - bin/console
71
88
  - bin/setup
72
89
  - cspec.gemspec
90
+ - examples/advance/Gemfile
91
+ - examples/advance/Gemfile.lock
92
+ - examples/advance/myspec.rb
93
+ - examples/advance/specs.csv
73
94
  - examples/basic/Gemfile
74
95
  - examples/basic/Gemfile.lock
75
96
  - examples/basic/myspec.rb
76
97
  - examples/basic/specs.csv
98
+ - examples/class_methods/Gemfile
99
+ - examples/class_methods/Gemfile.lock
100
+ - examples/class_methods/myspec.rb
101
+ - examples/class_methods/specs.csv
102
+ - examples/method_args/Gemfile
103
+ - examples/method_args/Gemfile.lock
104
+ - examples/method_args/myspec.rb
105
+ - examples/method_args/specs.csv
77
106
  - lib/cspec.rb
107
+ - lib/cspec/code_exec.rb
108
+ - lib/cspec/data_type.rb
109
+ - lib/cspec/loader.rb
110
+ - lib/cspec/result.rb
111
+ - lib/cspec/results_outputter.rb
112
+ - lib/cspec/runner.rb
113
+ - lib/cspec/spec.rb
114
+ - lib/cspec/validator.rb
78
115
  - lib/cspec/version.rb
79
- - lib/result.rb
80
116
  homepage: https://github.com/jarroddalefolino/cspec
81
117
  licenses:
82
118
  - MIT
@@ -90,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
126
  requirements:
91
127
  - - ">="
92
128
  - !ruby/object:Gem::Version
93
- version: '0'
129
+ version: 2.5.0
94
130
  required_rubygems_version: !ruby/object:Gem::Requirement
95
131
  requirements:
96
132
  - - ">="
data/lib/result.rb DELETED
@@ -1,31 +0,0 @@
1
- module CSpec
2
- class Result
3
- attr_reader :name, :class, :method, :error, :description, :details
4
-
5
- def self.success?(results)
6
- results.count {|r|r.error != nil} == 0
7
- end
8
-
9
- def initialize(name, klass, method, error, description, details)
10
- @name = name
11
- @error = error
12
- @class = klass
13
- @method = method
14
- @description = description
15
- @details = details
16
- end
17
-
18
- def ==(other)
19
- name == other.name &&
20
- self.class == other.class &&
21
- self.method == other.method &&
22
- self.error == other.error &&
23
- self.description == other.description &&
24
- self.details == other.details
25
- end
26
-
27
- def to_s
28
- "name: #{self.name}, class: #{self.class}, method: #{self.method}, error: #{self.error}, description: #{self.description}, details: #{self.details}"
29
- end
30
- end
31
- end