rspec-log_matcher 1.0.0 → 1.1.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
  SHA256:
3
- metadata.gz: 5cff49aaad12c7e78ee918b21bba1e19d609b5098d0da6dfad8d58a91f64dd23
4
- data.tar.gz: d19d360da5c337292ca0e85a15de74a080cc4ecc1469118fad5a96c7a64f44e2
3
+ metadata.gz: c0776bac137f314b34464562429b617a5d1761e565246f7c4c276d3b0a4c9a74
4
+ data.tar.gz: 30e732e05b490946c17e963c8402103755c0cd80214bd45b3119b3af2c903fa3
5
5
  SHA512:
6
- metadata.gz: a284eb8e2aa71e6a6f69b0b7fbd3c5f68cabab1a5713845b456641070d42c022039d8bbfcc14819d3167e15e27b8d1d548ee7a089df7244143110762aa226367
7
- data.tar.gz: '08cde836ee3666ea3f5133e535ca27f263fee6de0906681e8838e6a1b7c49d5c2892ea54fbe626a023bd31698ff9c23e7a5cba8a8035651651b6d815a67130d2'
6
+ metadata.gz: f544882c2a8d0625e084e6175ff1b3237ca73d854849bf361a81ccc45d3fecfa64a870f3ff99e624b9292be3d2ad0ee075911f894cb3075204894550437ac6fa
7
+ data.tar.gz: 26af4d821cc210e269812867cc7a515bd9ce75a81faed9ad2e422c069cc313fdfac348e5c0e1e1d8acb0a60728896cdd80e679e5228829d3a25565e26370069b
@@ -1,5 +1,11 @@
1
1
  # master
2
2
 
3
+ # 1.1.0
4
+
5
+ * Adding a class method `configure!` to configure the matcher
6
+
7
+ *Juan Manuel Ramallo*
8
+
3
9
  # 1.0.0
4
10
 
5
11
  * Log matcher added
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # RSpec::LogMatcher
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/rspec-log_matcher.svg)](https://badge.fury.io/rb/rspec-log_matcher)
4
+ [![ci](https://github.com/juanmanuelramallo/rspec-log_matcher/workflows/ci/badge.svg?branch=master)](https://github.com/juanmanuelramallo/rspec-log_matcher/actions)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/145ad4334a67d5e1f8a2/maintainability)](https://codeclimate.com/github/juanmanuelramallo/rspec-log_matcher/maintainability)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/145ad4334a67d5e1f8a2/test_coverage)](https://codeclimate.com/github/juanmanuelramallo/rspec-log_matcher/test_coverage)
7
+
3
8
  ## What is this?
4
9
  An RSpec custom matcher to test code that logs information into log files.
5
10
 
@@ -19,6 +24,16 @@ And then execute:
19
24
 
20
25
  $ bundle install
21
26
 
27
+ Lastly, in your `spec_helper.rb` (or `rails_helper.rb`) add the following line inside the configuration block:
28
+
29
+ ```ruby
30
+ RSpec.configure do |config|
31
+ # [snip]
32
+
33
+ RSpec::LogMatcher.configure!(config)
34
+ end
35
+ ```
36
+
22
37
  ## Usage
23
38
 
24
39
  ### Plain old ruby objects
@@ -1,21 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rspec/log_matcher'
4
-
5
- module RSpec
6
- module LogMatcher
7
- class Error < StandardError; end
8
-
9
- def log(expected_logs)
10
- Matcher.new(expected_logs, @log_file_position)
11
- end
12
-
13
- ::RSpec.configure do |config|
14
- config.before(:each, type: :feature) do
15
- @log_file_position = File.new(Matcher::LOG_PATH).sysseek(0, IO::SEEK_END)
16
- end
17
-
18
- config.include ::RSpec::LogMatcher
19
- end
20
- end
21
- end
@@ -2,3 +2,21 @@
2
2
 
3
3
  require 'rspec/log_matcher/version'
4
4
  require 'rspec/log_matcher/matcher'
5
+
6
+ module RSpec
7
+ module LogMatcher
8
+ class Error < StandardError; end
9
+
10
+ def self.configure!(config)
11
+ config.before(:each, type: :feature) do
12
+ @log_file_position = File.new(Matcher::LOG_PATH).sysseek(0, IO::SEEK_END)
13
+ end
14
+
15
+ config.include ::RSpec::LogMatcher
16
+ end
17
+
18
+ def log(expected_logs)
19
+ Matcher.new(expected_logs, @log_file_position)
20
+ end
21
+ end
22
+ end
@@ -3,7 +3,7 @@
3
3
  module Rspec
4
4
  module LogMatcher
5
5
  MAJOR = 1
6
- MINOR = 0
6
+ MINOR = 1
7
7
  PATCH = 0
8
8
 
9
9
  VERSION = [MAJOR, MINOR, PATCH].join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-log_matcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Manuel Ramallo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-20 00:00:00.000000000 Z
11
+ date: 2020-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core