rspec_fixtures 0.7.3 → 0.7.4.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -32
- data/lib/rspec_fixtures/rspec_config.rb +3 -0
- data/lib/rspec_fixtures/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e0f701006eeed4d48cb5131c6d9382b7a0b35e7d58bd904be5441c8fe7ebf1a
|
4
|
+
data.tar.gz: 9da9ab41e034db66543584f0f110d6d1e7d2624aed5c2d7105d737f1cd9e1586
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db6ee40206b5c93a9ba0494c5c68a10e578fc53fceae336aee6a5a137b11a6beb6bea673cbe29e722f772720c940428b5a456639c0804f78a0a378c56fa26dd6
|
7
|
+
data.tar.gz: 4186efba630430481dbfbf1da5661fe30318aade1fdc6721c666c3d31236de4212d35959df8b9f18ad7143f595b7af95d80f5b803cbad802f08c14f32367a4a1
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
RSpec Fixtures
|
2
|
-
==================================================
|
1
|
+
# RSpec Fixtures
|
3
2
|
|
4
3
|
[![Gem Version](https://badge.fury.io/rb/rspec_fixtures.svg)](https://badge.fury.io/rb/rspec_fixtures)
|
5
4
|
[![Build Status](https://github.com/DannyBen/rspec_fixtures/workflows/Test/badge.svg)](https://github.com/DannyBen/rspec_fixtures/actions?query=workflow%3ATest)
|
@@ -13,14 +12,11 @@ content.
|
|
13
12
|
This is a *"What You See is What You Test"* for your specs, because
|
14
13
|
*a Fixture is worth a thousand Mocks*... (too much?...)
|
15
14
|
|
16
|
-
![
|
15
|
+
![Demo](demo/cast.svg)
|
17
16
|
|
18
17
|
---
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
Install
|
23
|
-
--------------------------------------------------
|
19
|
+
## Install
|
24
20
|
|
25
21
|
```
|
26
22
|
$ gem install rspec_fixtures
|
@@ -32,10 +28,7 @@ Or with bundler:
|
|
32
28
|
gem 'rspec_fixtures'
|
33
29
|
```
|
34
30
|
|
35
|
-
|
36
|
-
|
37
|
-
Usage
|
38
|
-
--------------------------------------------------
|
31
|
+
## Usage
|
39
32
|
|
40
33
|
Require the gem in your spec helper:
|
41
34
|
|
@@ -54,10 +47,7 @@ describe 'ls' do
|
|
54
47
|
end
|
55
48
|
```
|
56
49
|
|
57
|
-
|
58
|
-
|
59
|
-
Matchers
|
60
|
-
--------------------------------------------------
|
50
|
+
## Matchers
|
61
51
|
|
62
52
|
### `match_fixture` - Compare Strings
|
63
53
|
|
@@ -89,10 +79,7 @@ Compare a raised exception with a pre-approved fixture.
|
|
89
79
|
expect { raise 'some error' }.to raise_fixture('fixture_filename')
|
90
80
|
```
|
91
81
|
|
92
|
-
|
93
|
-
|
94
|
-
Modifiers
|
95
|
-
--------------------------------------------------
|
82
|
+
## Modifiers
|
96
83
|
|
97
84
|
### `diff` - String similarity
|
98
85
|
|
@@ -108,7 +95,6 @@ expect ('some string').to match_fixture('fixture_filename').diff(5)
|
|
108
95
|
expect { puts 'some string' }.to output_fixture('fixture_filename').diff(5)
|
109
96
|
```
|
110
97
|
|
111
|
-
|
112
98
|
### `except` - Exclude by regular expression
|
113
99
|
|
114
100
|
Adding `except(regex)` to either `match_fixture` or `output_fixture` will
|
@@ -148,9 +134,7 @@ end
|
|
148
134
|
|
149
135
|
```
|
150
136
|
|
151
|
-
|
152
|
-
Configuration
|
153
|
-
--------------------------------------------------
|
137
|
+
## Configuration
|
154
138
|
|
155
139
|
### `interactive_fixtures`
|
156
140
|
|
@@ -164,7 +148,6 @@ RSpec.configure do |config|
|
|
164
148
|
end
|
165
149
|
```
|
166
150
|
|
167
|
-
|
168
151
|
### `fixtures_path`
|
169
152
|
|
170
153
|
By default, fixtures are stored in `spec/fixtures`. To change the path,
|
@@ -176,7 +159,6 @@ RSpec.configure do |config|
|
|
176
159
|
end
|
177
160
|
```
|
178
161
|
|
179
|
-
|
180
162
|
### `auto_approve`
|
181
163
|
|
182
164
|
If you wish to automatically approve all new or changed fixtures, you can
|
@@ -197,7 +179,6 @@ delete the fixtures folder, and run the specs again with:
|
|
197
179
|
$ AUTO_APPROVE=1 rspec
|
198
180
|
```
|
199
181
|
|
200
|
-
|
201
182
|
### `strip_ansi_escape`
|
202
183
|
|
203
184
|
In case your output strings contain ANSI escape codes that you wish to avoid
|
@@ -209,7 +190,6 @@ RSpec.configure do |config|
|
|
209
190
|
end
|
210
191
|
```
|
211
192
|
|
212
|
-
|
213
193
|
### `before_approval`
|
214
194
|
|
215
195
|
In case you need to alter the actual output globally, you can provide the
|
@@ -226,10 +206,9 @@ RSpec.configure do |config|
|
|
226
206
|
end
|
227
207
|
```
|
228
208
|
|
209
|
+
## Advanced Usage Tips
|
229
210
|
|
230
|
-
|
231
|
-
Advanced Usage Tips
|
232
|
-
--------------------------------------------------
|
211
|
+
### Sending output directly to RSpecFixtures
|
233
212
|
|
234
213
|
In some cases, you might need to send output directly to the `RSpecFixture`
|
235
214
|
stream capturer.
|
@@ -252,8 +231,16 @@ as an alternative to this:
|
|
252
231
|
logger = Logger.new($stdout)
|
253
232
|
```
|
254
233
|
|
255
|
-
|
256
|
-
|
234
|
+
### Consistent terminal width
|
235
|
+
|
236
|
+
In case you are testing standard output with long lines, you may encounter inconsistencies when testing on different hosts, with varying terminal width. In order to ensure consistent output to stdout, you may want to set a known terminal size in your `spec_helper`:
|
237
|
+
|
238
|
+
```ruby
|
239
|
+
ENV['COLUMNS'] = '80'
|
240
|
+
ENV['LINES'] = '24'
|
241
|
+
```
|
242
|
+
|
243
|
+
## Contributing / Support
|
257
244
|
|
258
245
|
If you experience any issue, have a question or a suggestion, or if you wish
|
259
246
|
to contribute, feel free to [open an issue][issues].
|
@@ -1,5 +1,8 @@
|
|
1
1
|
# Add our custom matchers and configuration options to RSpec
|
2
2
|
if defined? RSpec
|
3
|
+
# Fix for rails
|
4
|
+
require 'rspec/core' unless RSpec.respond_to? :configure
|
5
|
+
|
3
6
|
RSpec.configure do |config|
|
4
7
|
config.include RSpecFixtures::Matchers
|
5
8
|
config.add_setting :fixtures_path, default: File.expand_path('spec/fixtures')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_fixtures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -113,11 +113,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: 2.3.0
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- - "
|
116
|
+
- - ">"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
118
|
+
version: 1.3.1
|
119
119
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
120
|
+
rubygems_version: 3.1.2
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Interactive RSpec Fixtures
|