rspec-file_fixtures 0.1.4 → 0.1.5

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: 85d67f3d04a4a97738f1626c01c8a95c75ad0925e0e0aa02c012aa977b4cb5c8
4
- data.tar.gz: 32518d16d21e798f15b44c0b498cdf6df0a95941194d7a640a6ad6553f5fdfa1
3
+ metadata.gz: 06bd6ac7ead0f64696bd1ed156d182ef14cf10fe252e19f7a4de489f08c5a0a5
4
+ data.tar.gz: c611cce7ce610ec5ddcc7ddc7a2e9968782c0daf39d96d203ea179c753ccd6f0
5
5
  SHA512:
6
- metadata.gz: 564b89fae7079ca7e59f12b28362660ba9a7e47cb9fdf6de3d5fbe3e365e227c4d603baa545a5a327340e399d5f43bbae3b6515f1640ddd6c8ceb37e54256693
7
- data.tar.gz: 29ef70ef81b8a13f076fc454544281a84b5828d2f3dc03d9fedf3960a6e1f6e5277488fe6b0b61d8cd2f708bf09ac3dc94d3acdfd90a6f3599715cfb229bbf9b
6
+ metadata.gz: 037c9ff6a4179224b55842dcb9e5b59e8a1363f4be807b765f8d8449e2b80ba365e9684cbdbba5b64220e7a56d3f8c0ff41c27905d47c6923ebafc2bee2de256
7
+ data.tar.gz: 9f777d0e72d6a434fe0c90215cebb8a427b689c8e632a033d66873f2001dff1a7de3a42f21cdb0b15425e7f7862b033a7e41ce4895383ab92fe61e5dc00af456
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in rspec-file_fixtures.gemspec
6
6
  gemspec
7
7
 
8
- gem 'devpack', '~> 0.3.2'
8
+ gem 'devpack', '~> 0.4.0'
9
9
  gem 'nokogiri', '~> 1.11'
10
10
  gem 'rake', '~> 12.0'
11
11
  gem 'rspec', '~> 3.0'
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GEM
9
9
  specs:
10
10
  ast (2.4.2)
11
11
  concurrent-ruby (1.1.8)
12
- devpack (0.3.2)
12
+ devpack (0.4.0)
13
13
  diff-lcs (1.4.4)
14
14
  i18n (1.8.9)
15
15
  concurrent-ruby (~> 1.0)
@@ -68,7 +68,7 @@ PLATFORMS
68
68
  ruby
69
69
 
70
70
  DEPENDENCIES
71
- devpack (~> 0.3.2)
71
+ devpack (~> 0.4.0)
72
72
  nokogiri (~> 1.11)
73
73
  rake (~> 12.0)
74
74
  rspec (~> 3.0)
@@ -80,4 +80,4 @@ DEPENDENCIES
80
80
  strong_versions (~> 0.4.5)
81
81
 
82
82
  BUNDLED WITH
83
- 2.2.16
83
+ 2.2.33
data/README.md CHANGED
@@ -7,7 +7,7 @@ A simple and convenient file fixture loader for [_RSpec_](https://rspec.info/).
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'rspec-file_fixtures', '~> 0.1.4'
10
+ gem 'rspec-file_fixtures', '~> 0.1.5'
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -36,7 +36,7 @@ Use the returned `Fixture` object's various methods in your tests:
36
36
 
37
37
  ```ruby
38
38
  it 'loads data' do
39
- expect(subject.load(my_fixture.read)).to eql my_fixture.json
39
+ expect(subject.load(my_fixture.read)).to eql my_fixture.from_json
40
40
  end
41
41
  ```
42
42
 
@@ -46,19 +46,19 @@ The following methods are provided on the `Fixture` object:
46
46
  |-|-|
47
47
  |`#read`|Read the contents of the fixture file as a string|
48
48
  |`#path`|The absolute path to the fixture file|
49
- |`#json`|The parsed _JSON_ content from the file|
50
- |`#yaml`|The parsed _YAML_ content from the file (aliased as `#yml`)|
51
- |`#xml`|The parsed _XML_ content from the file (requires the [_Nokogiri_](https://nokogiri.org/) gem and returns a `Nokogiri::XML::Document`)|
49
+ |`#from_json`|The parsed _JSON_ content from the file|
50
+ |`#from_yaml`|The parsed _YAML_ content from the file (aliased as `#from_yml`)|
51
+ |`#from_xml`|The parsed _XML_ content from the file (requires the [_Nokogiri_](https://nokogiri.org/) gem and returns a `Nokogiri::XML::Document`)|
52
52
 
53
53
  ### Symbolize Names
54
54
 
55
- By default `Fixture#yaml` and `Fixture#json` symbolize all keys in their output. To disable this behaviour, pass `symbolize_names: true` to either method. A shorthand version of this is available by simply passing `false` as the only parameter:
55
+ By default `Fixture#from_yaml` and `Fixture#from_json` symbolize all keys in their output. To disable this behaviour, pass `symbolize_names: false` to either method. A shorthand version of this is available by simply passing `false` as the only parameter:
56
56
 
57
57
  ```ruby
58
- expect(subject.load(my_fixture.yaml(symbolize_names: false))).to eql({ 'foo' => 'bar' })
59
- expect(subject.load(my_fixture.json(symbolize_names: false))).to eql({ 'foo' => 'bar' })
60
- expect(subject.load(my_fixture.yaml(false))).to eql({ 'foo' => 'bar' })
61
- expect(subject.load(my_fixture.json(false))).to eql({ 'foo' => 'bar' })
58
+ expect(subject.load(my_fixture.from_yaml(symbolize_names: false))).to eql({ 'foo' => 'bar' })
59
+ expect(subject.load(my_fixture.from_json(symbolize_names: false))).to eql({ 'foo' => 'bar' })
60
+ expect(subject.load(my_fixture.from_yaml(false))).to eql({ 'foo' => 'bar' })
61
+ expect(subject.load(my_fixture.from_json(false))).to eql({ 'foo' => 'bar' })
62
62
  ```
63
63
 
64
64
  ## License
@@ -11,7 +11,7 @@ module RSpecFileFixtures
11
11
  pathname.read
12
12
  end
13
13
 
14
- def xml
14
+ def from_xml
15
15
  require 'nokogiri'
16
16
  Nokogiri::XML.parse(read)
17
17
  end
@@ -23,16 +23,23 @@ module RSpecFileFixtures
23
23
  end
24
24
 
25
25
  # rubocop:disable Style/OptionalBooleanParameter
26
- def json(symbolize_names_shorthand = true, symbolize_names: true)
26
+ def from_json(symbolize_names_shorthand = true, symbolize_names: true)
27
27
  JSON.parse(read, symbolize_names: symbolize_names & symbolize_names_shorthand)
28
28
  end
29
29
 
30
- def yaml(symbolize_names_shorthand = true, symbolize_names: true)
30
+ def from_yaml(symbolize_names_shorthand = true, symbolize_names: true)
31
31
  YAML.safe_load(read, symbolize_names: symbolize_names & symbolize_names_shorthand)
32
32
  end
33
33
  # rubocop:enable Style/OptionalBooleanParameter
34
34
 
35
- alias yml yaml
35
+ alias from_yml from_yaml
36
+
37
+ # Backward compatibility
38
+ alias yml from_yml
39
+ alias yaml from_yaml
40
+ alias xml from_xml
41
+ alias json from_json
42
+ # /Backward compatibility
36
43
 
37
44
  private
38
45
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RSpecFileFixtures
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-file_fixtures
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-02 00:00:00.000000000 Z
11
+ date: 2022-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec