rspec-side_effects 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d4c1faa5a5a16d11a789cfb49dfc5553888e9dd
4
- data.tar.gz: 416e8e2d16b05bb667faf2d78fd61de198a1094e
3
+ metadata.gz: 84f7b1e6ac56d84ea306895f30239a9fa52e5fa3
4
+ data.tar.gz: 368c83fba08d99226868478c56c2e812a3dc01c7
5
5
  SHA512:
6
- metadata.gz: 8ae7e359642a787e43fdd684f8077ecdbeaa0d6aa15e5ce636cbc8872e2ad00728b8ac73068d9fbbf021d9d7ce9e430d2438fcb78d4a40a7a63c9a3307ec847e
7
- data.tar.gz: 6bd7444350e204568d342c97ab0813236a1da58af02e38aee2e554d122ec1b71d5a04657a425479f72e90a185d517871af54195cbf2d5b0259a65b5816820995
6
+ metadata.gz: 7fb0192e7375f532b214813025c6b8784eecda7293b5a4f22c4dfb4d88741e1e312018a5113ae9730dc228470582d919f577929911b4bfc97a7a4c68a7283773
7
+ data.tar.gz: 479eb0d57005fb506efa3f0617205ef1f2df9970a6648be000c57d910189d8216bc896d8de0257658f58668ab4ea869ed64e49f9a1870f6edc0a63718d1b3c26
@@ -5,3 +5,7 @@ Metrics/MethodLength:
5
5
 
6
6
  RSpec/EmptyExampleGroup:
7
7
  Enabled: false
8
+
9
+ Metrics/BlockLength:
10
+ Exclude:
11
+ - spec/**/**
@@ -15,5 +15,10 @@ os:
15
15
  - linux
16
16
  - osx
17
17
  sudo: false
18
- after_success:
19
- - bundle exec codeclimate-test-reporter
18
+ before_script:
19
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-darwin-amd64 > ./cc-test-reporter ; fi
20
+ - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter ; fi
21
+ - chmod +x ./cc-test-reporter
22
+ - ./cc-test-reporter before-build
23
+ after_script:
24
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
@@ -6,7 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ## 0.0.1 - 2018-05-02
9
+ ## 0.2.0 - 2018-07-12
10
+ ### Changed
11
+ - Rescue Exceptions from the subject in the its_side_effects_are helper, so
12
+ that it is possible to check the side effects of a method which is expected
13
+ to raise an error
14
+
15
+ ## 0.1.0 - 2018-05-02
10
16
  ### Added
11
17
  - Add the its_side_effects_are helper, as well as its aliases it_has_side_effects
12
- and specify_side_effects
18
+ and specify_side_effects.
data/README.md CHANGED
@@ -1,14 +1,13 @@
1
1
  # Rspec::SideEffects
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/rspec-side_effects.svg)](http://badge.fury.io/rb/rspec-side_effects)
4
- [![Dependency Status](https://gemnasium.com/sugarcrm/rspec-side_effects.svg)](https://gemnasium.com/sugarcrm/rspec-side_effects)
5
4
  [![Build Status](https://travis-ci.org/sugarcrm/rspec-side_effects.svg?branch=master)](https://travis-ci.org/sugarcrm/rspec-side_effects)
6
5
  [![Code Climate](https://codeclimate.com/github/sugarcrm/rspec-side_effects/badges/gpa.svg)](https://codeclimate.com/github/sugarcrm/rspec-side_effects)
7
6
  [![Test Coverage](https://codeclimate.com/github/sugarcrm/rspec-side_effects/badges/coverage.svg)](https://codeclimate.com/github/sugarcrm/rspec-side_effects/coverage)
8
7
  [![Inline docs](http://inch-ci.org/github/sugarcrm/rspec-side_effects.svg)](http://inch-ci.org/github/sugarcrm/rspec-side_effects)
9
8
  [![License](http://img.shields.io/badge/license-Apache2-green.svg?style=flat)](LICENSE)
10
9
 
11
- RSpec extension for check the side effects of your specifications.
10
+ RSpec extension for checking the side effects of your specifications.
12
11
 
13
12
  ## Installation
14
13
 
@@ -32,10 +31,10 @@ This gem is intended to replace explicitly calling the *subject* before checking
32
31
  its side effects. It might be used when testing things like:
33
32
  * method which works directly with a database
34
33
  * method which works directly with a file system
35
- * method which integrates mocked objects
34
+ * method which only integrates mocked objects
36
35
 
37
36
  There are several aliases for *it_has_side_effects_are* which can be used to
38
- communicate different things.
37
+ communicate different things to the reader.
39
38
 
40
39
  ```
41
40
  subject { test_class.test }
@@ -74,6 +73,19 @@ its_side_effects_are do
74
73
  end
75
74
  ```
76
75
 
76
+ Exceptions are also rescued by the helper, so you can still check side effects
77
+ which also expecting an exception to be raised.
78
+
79
+ ```
80
+ subject { test_class.test }
81
+
82
+ it { expect { subject }.to raise_error(StandardError) }
83
+ its_side_effects_are do
84
+ # Check what might have happened before the exception.
85
+ # Or confirm things which should not have happend with an error.
86
+ end
87
+ ```
88
+
77
89
  ## Development
78
90
 
79
91
  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.
data/Rakefile CHANGED
@@ -1,7 +1,10 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
  require 'rubocop/rake_task'
4
+ require 'bundler/audit/task'
4
5
  require 'pathname'
6
+ require 'license_finder'
7
+ require 'English'
5
8
 
6
9
  RSpec::Core::RakeTask.new(:spec) do |task|
7
10
  task.rspec_opts = '--warnings'
@@ -23,4 +26,13 @@ RuboCop::RakeTask.new(:rubocop) do |task|
23
26
  ].push(rubocop_report_pathname.to_s)
24
27
  end
25
28
 
26
- task default: %i[spec rubocop]
29
+ Bundler::Audit::Task.new
30
+
31
+ desc 'Check dependency licenses'
32
+ task :license_finder do
33
+ puts `license_finder --quiet --format text`
34
+
35
+ abort('LicenseFinder failed') unless $CHILD_STATUS.success?
36
+ end
37
+
38
+ task default: %i[spec rubocop bundle:audit license_finder]
@@ -16,7 +16,11 @@ module Rspec
16
16
 
17
17
  describe('side effects', *options) do
18
18
  if block
19
- before { subject }
19
+ before do
20
+ # rubocop:disable Lint/HandleExceptions, Lint/RescueException
21
+ begin; subject; rescue Exception; end
22
+ # rubocop:enable Lint/HandleExceptions, Lint/RescueException
23
+ end
20
24
  example(nil, :aggregate_failures, *options, &block)
21
25
  else
22
26
  example(nil, {}) { subject }
@@ -1,5 +1,5 @@
1
1
  module Rspec
2
2
  module SideEffects
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
@@ -32,7 +32,8 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  # Dependencies whose APIs we do not really depend upon, and can be upgraded
34
34
  # without limiting.
35
- spec.add_development_dependency 'codeclimate-test-reporter'
35
+ spec.add_development_dependency 'bundler-audit'
36
+ spec.add_development_dependency 'license_finder'
36
37
  spec.add_development_dependency 'rubocop'
37
38
  spec.add_development_dependency 'rubocop-rspec'
38
39
  spec.add_development_dependency 'simplecov'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-side_effects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Sullivan Cant
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-02 00:00:00.000000000 Z
11
+ date: 2018-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core
@@ -67,7 +67,21 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: codeclimate-test-reporter
70
+ name: bundler-audit
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: license_finder
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
@@ -142,6 +156,7 @@ files:
142
156
  - Rakefile
143
157
  - bin/console
144
158
  - bin/setup
159
+ - doc/dependency_decisions.yml
145
160
  - lib/rspec/side_effects.rb
146
161
  - lib/rspec/side_effects/version.rb
147
162
  - rspec-side_effects.gemspec