cspec 0.1.0 → 0.1.3

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: 3e4cf26ccc928bfb32f2df849a792f249818086e11fe264dabad53901d519fc0
4
- data.tar.gz: 1bf1d5807d47bdf4616b217da02f40005c3ccff3a6656861e6b8728a3de896b2
3
+ metadata.gz: 0e6512690d45aa69b0fd226cb3cbca981c05b5f162abee524553e5f91aefa6d3
4
+ data.tar.gz: 86de0ecc3c9ef516fb6826982bd0688dade55354d487a35670df4e868ea99098
5
5
  SHA512:
6
- metadata.gz: 5f6dc80e412e391af9d36e4a6f92d0d3745e7b48e811520d4ba3ea1a144d125ed873476699bf838e8aa703093e7ae07560995386faeedbd1c44504832bfdfa7f
7
- data.tar.gz: 2a0bab71e383caf3db3ca2a80a867ddc2a6ec1f64be227ac16954d8176f9ab1c9388643cacbeb8a239b4ef3717fedc497b180fc40f4c9283ad54e5fd4c913bfd
6
+ metadata.gz: ecf7e5dbce6382722a9cf26bef10c8d75a940d797dc6ddc23c971131084321a2cc6aa3248a816ab0301fb16d5aef0e62980cc38ca5de7feea1341750719f59f6
7
+ data.tar.gz: c2830c4864d15e6861948bf5bd1da88ca11066f676d82cbd0c47865a983cc7f1357c73e55db23551c0f08ef73915c5697ea953111c5c431ae777c824a1e3f54c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cspec (0.1.0)
4
+ cspec (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,43 +1,34 @@
1
1
  # Cspec
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/cspec`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ ## Running test cases via CSV
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ The goal of this project is to have a centralised location where all specs can be run
6
6
 
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
7
+ ## Quick start
10
8
 
9
+ * Add this to your `Gemfile`
11
10
  ```ruby
12
- gem 'cspec'
11
+ gem 'cspec'
12
+ ```
13
+ * Create a CSV named `specs.csv` with the following spec
14
+ ```csv
15
+ class,name,type,initialize_params_1,method,method_args_1,expected
16
+ MyClass,my test,,hello,,world
17
+ ```
18
+ * Create a file named `my_csv_specs.rb` to run the specs
19
+ ```ruby
20
+ require 'cspec'
21
+
22
+ # The implementation of the Ruby class being testedc
23
+ class MyClass
24
+ def hello
25
+ 'world'
26
+ end
27
+ end
28
+
29
+ # Running the specs
30
+ result = CSpec::Runner.run!("#{Dir.pwd}/specs.csv")
31
+ puts "Success: #{result}"
13
32
  ```
14
33
 
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install cspec
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cspec. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
-
37
- ## License
38
-
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
-
41
- ## Code of Conduct
42
-
43
- Everyone interacting in the Cspec project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/cspec/blob/master/CODE_OF_CONDUCT.md).
34
+ * Run with `ruby my_csv_specs.rb`
data/cspec.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
 
13
13
  spec.summary = 'CSV Spec'
14
14
  spec.description = 'A testing framework to run unit tests via csv'
15
- spec.homepage = 'https://www.coderacadmeny.edu.au'
15
+ spec.homepage = 'https://github.com/jarroddalefolino/cspec'
16
16
  spec.license = 'MIT'
17
17
 
18
18
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gem 'cspec'
@@ -0,0 +1,13 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ cspec (0.1.2)
5
+
6
+ PLATFORMS
7
+ ruby
8
+
9
+ DEPENDENCIES
10
+ cspec
11
+
12
+ BUNDLED WITH
13
+ 1.17.2
@@ -0,0 +1,10 @@
1
+ require 'cspec'
2
+
3
+ class MyClass
4
+ def hello
5
+ 'world'
6
+ end
7
+ end
8
+
9
+ result = CSpec::Runner.run!("#{Dir.pwd}/specs.csv")
10
+ puts "Success: #{result}"
@@ -0,0 +1,2 @@
1
+ class,name,type,method,expected
2
+ MyClass,my test,instance,hello,worldsds
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.0'
4
+ VERSION = '0.1.3'
5
5
  end
data/lib/cspec.rb CHANGED
@@ -32,7 +32,6 @@ module CSpec
32
32
  def self.do_instance(spec)
33
33
  class_under_test = Object.const_get(spec[:class])
34
34
  instance_under_test = class_under_test.new(*spec[:initialize_params])
35
- puts spec[:method_args]
36
35
  instance_under_test.send(spec[:method], *spec[:method_args])
37
36
  end
38
37
 
@@ -68,10 +67,10 @@ module CSpec
68
67
  specs = Loader.load(filepath)
69
68
  results = run(specs)
70
69
 
71
- ResultsOutputter.display(results)
72
70
  if CSpec::Result.success?(results)
73
71
  return true
74
72
  else
73
+ ResultsOutputter.display(results)
75
74
  return false
76
75
  end
77
76
  end
@@ -88,11 +87,10 @@ module CSpec
88
87
 
89
88
  result = ::CSpec::DataType.convert(result)
90
89
  results << if result == ::CSpec::DataType.convert(spec[:expected])
91
- Result.new(spec[:name], spec[:class], spec[:method], nil, spec[:description], nil)
90
+ Result.new(spec['name'], spec['class'], spec['method'], nil, spec['description'], nil)
92
91
  else
93
- puts 'here'
94
- Result.new(spec[:name], spec[:class], spec[:method],
95
- "Expected #{spec[:expected]}, got: #{result}", spec[:description], nil)
92
+ Result.new(spec['name'], spec['class'], spec['method'],
93
+ "Expected #{spec[:expected]}, got: #{result}", spec['description'], nil)
96
94
  end
97
95
  rescue StandardError => e
98
96
  results << Result.new(spec[:name], spec[:class], spec[:method], e.inspect, spec[:description], nil)
data/lib/result.rb CHANGED
@@ -18,10 +18,10 @@ module CSpec
18
18
  def ==(other)
19
19
  name == other.name &&
20
20
  self.class == other.class &&
21
- method == other.method &&
22
- error == other.error &&
23
- description == other.description &&
24
- details == other.details
21
+ self.method == other.method &&
22
+ self.error == other.error &&
23
+ self.description == other.description &&
24
+ self.details == other.details
25
25
  end
26
26
 
27
27
  def to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarrod Folino
@@ -70,14 +70,18 @@ files:
70
70
  - bin/console
71
71
  - bin/setup
72
72
  - cspec.gemspec
73
+ - examples/basic/Gemfile
74
+ - examples/basic/Gemfile.lock
75
+ - examples/basic/myspec.rb
76
+ - examples/basic/specs.csv
73
77
  - lib/cspec.rb
74
78
  - lib/cspec/version.rb
75
79
  - lib/result.rb
76
- homepage: https://www.coderacadmeny.edu.au
80
+ homepage: https://github.com/jarroddalefolino/cspec
77
81
  licenses:
78
82
  - MIT
79
83
  metadata:
80
- homepage_uri: https://www.coderacadmeny.edu.au
84
+ homepage_uri: https://github.com/jarroddalefolino/cspec
81
85
  post_install_message:
82
86
  rdoc_options: []
83
87
  require_paths: