cspec 0.1.2 → 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 +4 -4
- data/README.md +26 -35
- data/examples/basic/Gemfile +2 -0
- data/examples/basic/Gemfile.lock +13 -0
- data/examples/basic/myspec.rb +10 -0
- data/examples/basic/specs.csv +2 -0
- data/lib/cspec/version.rb +1 -1
- data/lib/cspec.rb +3 -3
- data/lib/result.rb +4 -4
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e6512690d45aa69b0fd226cb3cbca981c05b5f162abee524553e5f91aefa6d3
|
4
|
+
data.tar.gz: 86de0ecc3c9ef516fb6826982bd0688dade55354d487a35670df4e868ea99098
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecf7e5dbce6382722a9cf26bef10c8d75a940d797dc6ddc23c971131084321a2cc6aa3248a816ab0301fb16d5aef0e62980cc38ca5de7feea1341750719f59f6
|
7
|
+
data.tar.gz: c2830c4864d15e6861948bf5bd1da88ca11066f676d82cbd0c47865a983cc7f1357c73e55db23551c0f08ef73915c5697ea953111c5c431ae777c824a1e3f54c
|
data/README.md
CHANGED
@@ -1,43 +1,34 @@
|
|
1
1
|
# Cspec
|
2
2
|
|
3
|
-
|
3
|
+
## Running test cases via CSV
|
4
4
|
|
5
|
-
|
5
|
+
The goal of this project is to have a centralised location where all specs can be run
|
6
6
|
|
7
|
-
##
|
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
|
-
|
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/lib/cspec/version.rb
CHANGED
data/lib/cspec.rb
CHANGED
@@ -87,10 +87,10 @@ module CSpec
|
|
87
87
|
|
88
88
|
result = ::CSpec::DataType.convert(result)
|
89
89
|
results << if result == ::CSpec::DataType.convert(spec[:expected])
|
90
|
-
Result.new(spec[
|
90
|
+
Result.new(spec['name'], spec['class'], spec['method'], nil, spec['description'], nil)
|
91
91
|
else
|
92
|
-
Result.new(spec[
|
93
|
-
"Expected #{spec[:expected]}, got: #{result}", spec[
|
92
|
+
Result.new(spec['name'], spec['class'], spec['method'],
|
93
|
+
"Expected #{spec[:expected]}, got: #{result}", spec['description'], nil)
|
94
94
|
end
|
95
95
|
rescue StandardError => e
|
96
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.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jarrod Folino
|
@@ -70,6 +70,10 @@ 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
|