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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +15 -0
- data/lib/rspec-log_matcher.rb +0 -18
- data/lib/rspec/log_matcher.rb +18 -0
- data/lib/rspec/log_matcher/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0776bac137f314b34464562429b617a5d1761e565246f7c4c276d3b0a4c9a74
|
4
|
+
data.tar.gz: 30e732e05b490946c17e963c8402103755c0cd80214bd45b3119b3af2c903fa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f544882c2a8d0625e084e6175ff1b3237ca73d854849bf361a81ccc45d3fecfa64a870f3ff99e624b9292be3d2ad0ee075911f894cb3075204894550437ac6fa
|
7
|
+
data.tar.gz: 26af4d821cc210e269812867cc7a515bd9ce75a81faed9ad2e422c069cc313fdfac348e5c0e1e1d8acb0a60728896cdd80e679e5228829d3a25565e26370069b
|
data/CHANGELOG.md
CHANGED
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
|
data/lib/rspec-log_matcher.rb
CHANGED
@@ -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
|
data/lib/rspec/log_matcher.rb
CHANGED
@@ -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
|
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.
|
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-
|
11
|
+
date: 2020-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|