rspec-file_fixtures 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06bd6ac7ead0f64696bd1ed156d182ef14cf10fe252e19f7a4de489f08c5a0a5
4
- data.tar.gz: c611cce7ce610ec5ddcc7ddc7a2e9968782c0daf39d96d203ea179c753ccd6f0
3
+ metadata.gz: c78567396d3fd63b7f4daafa0cb226bcb0356889a6a55b7998e1121b49c7657e
4
+ data.tar.gz: 00a465a84406eaa3e859b0c1afc1f1bb9f811d2efe5771c33cfabc31be0c8f48
5
5
  SHA512:
6
- metadata.gz: 037c9ff6a4179224b55842dcb9e5b59e8a1363f4be807b765f8d8449e2b80ba365e9684cbdbba5b64220e7a56d3f8c0ff41c27905d47c6923ebafc2bee2de256
7
- data.tar.gz: 9f777d0e72d6a434fe0c90215cebb8a427b689c8e632a033d66873f2001dff1a7de3a42f21cdb0b15425e7f7862b033a7e41ce4895383ab92fe61e5dc00af456
6
+ metadata.gz: aa6d335a04dc1271cc4f46323ea06f12431edbce2935414e5c7cf838eb5df2d3d945be8b54707292494e3201d26f90d40a8c982c11e371f69b428c0546fe5164
7
+ data.tar.gz: 04b06c35060234ca74e00bcdc5b747681fc5ae71cd2b184839393f269bb61c23a5bd0524a0675ccb9f838ba7eec878f72e6a5c2be98e2fcdab873d89b0996d20
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-file_fixtures (0.1.4)
4
+ rspec-file_fixtures (0.1.6)
5
5
  rspec (~> 3.0)
6
6
 
7
7
  GEM
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.5'
10
+ gem 'rspec-file_fixtures', '~> 0.1.6'
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -35,11 +35,18 @@ let(:my_fixture) { fixture('fixture.json') }
35
35
  Use the returned `Fixture` object's various methods in your tests:
36
36
 
37
37
  ```ruby
38
- it 'loads data' do
38
+ it 'parses JSON data' do
39
39
  expect(subject.load(my_fixture.read)).to eql my_fixture.from_json
40
40
  end
41
41
  ```
42
42
 
43
+ ```ruby
44
+ it 'contains same filenames as fixture directory' do
45
+ # `#dirname` delegated to underlying `Pathname` object, returning a new `Pathname` instance:
46
+ expect(subject.created_files).to eql my_fixture.dirname.entries
47
+ end
48
+ ```
49
+
43
50
  The following methods are provided on the `Fixture` object:
44
51
 
45
52
  |Method|Definition|
@@ -50,6 +57,8 @@ The following methods are provided on the `Fixture` object:
50
57
  |`#from_yaml`|The parsed _YAML_ content from the file (aliased as `#from_yml`)|
51
58
  |`#from_xml`|The parsed _XML_ content from the file (requires the [_Nokogiri_](https://nokogiri.org/) gem and returns a `Nokogiri::XML::Document`)|
52
59
 
60
+ Methods not specifically defined above are delegated to the underlying `Pathname` object (`#join`, `#dirname`, `#mkpath`, etc.). See the [Pathname documentation](https://ruby-doc.org/stdlib-2.7.5/libdoc/pathname/rdoc/Pathname.html) for more details.
61
+
53
62
  ### Symbolize Names
54
63
 
55
64
  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:
@@ -43,6 +43,18 @@ module RSpecFileFixtures
43
43
 
44
44
  private
45
45
 
46
+ def method_missing(method_name, *args)
47
+ return pathname.public_send(method_name, *args) if respond_to_missing?(method_name)
48
+
49
+ super
50
+ end
51
+
52
+ def respond_to_missing?(method_name, _ = false)
53
+ return true if pathname.respond_to?(method_name)
54
+
55
+ super
56
+ end
57
+
46
58
  def pathname
47
59
  @pathname ||= base_path.join(@raw_path)
48
60
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RSpecFileFixtures
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-12 00:00:00.000000000 Z
11
+ date: 2022-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -69,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
- rubyforge_project:
73
- rubygems_version: 2.7.6.2
72
+ rubygems_version: 3.3.9
74
73
  signing_key:
75
74
  specification_version: 4
76
75
  summary: Simple file fixture loader for RSpec