rspec-file_fixtures 0.1.1 → 0.1.2

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: 1de1d59a65c84fb41468c17c06c6e488035cc6f3c9d1b4fb43917593a362f29a
4
- data.tar.gz: 6e2de881a420e0a4a5a233a4194173061c48784711da9bd5b2814151fa478ced
3
+ metadata.gz: 7e51ee7e50f2412ff8871adab3182e5e04c70dd3a6aca3c043f7bc8ce8ced4a8
4
+ data.tar.gz: d5cf13e34b08bbbc0d44bf8608d9f77a9720d0c0fee9c5d48dd45dd6cf952d71
5
5
  SHA512:
6
- metadata.gz: 0bbf1756eb5f5533a2863708b41af1e2fc3a0f2cbdb24eedbaae6c376f04f5fb9f1ef7d658c10696374bdbf1c3fe5dc15589ac53f5250a265d996f24ed38af41
7
- data.tar.gz: b8e61994c2597fd925024955abd2a72a4ab93857f998e0a31be8b812fc454630503135d9395aba56979ebdda1242aa229be42c50eba6a1dc074593770382f184
6
+ metadata.gz: b6a3ab956acd7209e4cf552f67d748841d2342aae85259c6163c666490e6e966ecd03913428f1e7cc8386a5b92c39e11402e6c5db35f1803901947223adc8911
7
+ data.tar.gz: 076a5a07bbe0bc6e0e78ade9833478487743ad58658fa9e1b6a9fb2d590e579b70770a861c2807f173083c1f2f60fbe25942aea6ad094701dc0b4c6d65645f5f
data/Gemfile.lock CHANGED
@@ -8,7 +8,8 @@ PATH
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- rspec-file_fixtures (0.1.1)
11
+ rspec-file_fixtures (0.1.2)
12
+ rspec (~> 3.0)
12
13
 
13
14
  GEM
14
15
  remote: https://rubygems.org/
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.1'
10
+ gem 'rspec-file_fixtures', '~> 0.1.2'
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -1,23 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'yaml'
4
- require 'json'
5
- require 'pathname'
6
-
7
- require 'rspec/file_fixtures/version'
8
- require 'rspec/file_fixtures/fixture'
9
-
10
- module RSpec
11
- # Provides a `fixture` method in all RSpec tests.
12
- module FileFixtures
13
- class Error < StandardError; end
14
-
15
- def fixture(path)
16
- Fixture.new(path)
17
- end
18
- end
19
- end
20
-
21
- RSpec.configure do |config|
22
- config.include(RSpec::FileFixtures)
23
- end
3
+ require 'rspec_file_fixtures'
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+ require 'json'
5
+ require 'pathname'
6
+ require 'rspec'
7
+
8
+ require 'rspec_file_fixtures/version'
9
+ require 'rspec_file_fixtures/fixture'
10
+
11
+ # Provides a `fixture` method in all RSpec tests.
12
+ module RSpecFileFixtures
13
+ class Error < StandardError; end
14
+
15
+ def fixture(path)
16
+ Fixture.new(path)
17
+ end
18
+ end
19
+
20
+ RSpec.configure do |config|
21
+ config.include(RSpecFileFixtures)
22
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RSpecFileFixtures
4
+ # Provides access to the contents and location of a file fixture.
5
+ class Fixture
6
+ def initialize(raw_path)
7
+ @raw_path = raw_path
8
+ end
9
+
10
+ def read
11
+ pathname.read
12
+ end
13
+
14
+ def yaml
15
+ YAML.safe_load(read, symbolize_names: true)
16
+ end
17
+
18
+ alias yml yaml
19
+
20
+ def xml
21
+ require 'nokogiri'
22
+ Nokogiri::XML.parse(read)
23
+ end
24
+
25
+ def path
26
+ pathname.realpath.to_s
27
+ end
28
+
29
+ def json
30
+ JSON.parse(read, symbolize_names: true)
31
+ end
32
+
33
+ private
34
+
35
+ def pathname
36
+ @pathname ||= base_path.join(@raw_path)
37
+ end
38
+
39
+ def base_path
40
+ Pathname.new(File.join('spec', 'fixtures'))
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RSpecFileFixtures
4
+ VERSION = '0.1.2'
5
+ end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'lib/rspec/file_fixtures/version'
3
+ require_relative 'lib/rspec_file_fixtures/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'rspec-file_fixtures'
7
- spec.version = RSpec::FileFixtures::VERSION
7
+ spec.version = RSpecFileFixtures::VERSION
8
8
  spec.authors = ['Bob Farrell']
9
9
  spec.email = ['git@bob.frl']
10
10
 
@@ -23,4 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.bindir = 'bin'
24
24
  spec.executables = []
25
25
  spec.require_paths = ['lib']
26
+ spec.add_dependency 'rspec', '~> 3.0'
26
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-file_fixtures
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
@@ -9,7 +9,21 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2021-02-24 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
13
27
  description: Load files from test fixtures directory quickly and conveniently
14
28
  email:
15
29
  - git@bob.frl
@@ -29,8 +43,9 @@ files:
29
43
  - bin/console
30
44
  - bin/setup
31
45
  - lib/rspec/file_fixtures.rb
32
- - lib/rspec/file_fixtures/fixture.rb
33
- - lib/rspec/file_fixtures/version.rb
46
+ - lib/rspec_file_fixtures.rb
47
+ - lib/rspec_file_fixtures/fixture.rb
48
+ - lib/rspec_file_fixtures/version.rb
34
49
  - rspec-file_fixtures.gemspec
35
50
  homepage: https://github.com/bobf/rspec-file_fixtures
36
51
  licenses:
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RSpec
4
- module FileFixtures
5
- # Provides access to the contents and location of a file fixture.
6
- class Fixture
7
- def initialize(raw_path)
8
- @raw_path = raw_path
9
- end
10
-
11
- def read
12
- pathname.read
13
- end
14
-
15
- def yaml
16
- YAML.safe_load(read, symbolize_names: true)
17
- end
18
-
19
- alias yml yaml
20
-
21
- def xml
22
- require 'nokogiri'
23
- Nokogiri::XML.parse(read)
24
- end
25
-
26
- def path
27
- pathname.realpath.to_s
28
- end
29
-
30
- def json
31
- JSON.parse(read, symbolize_names: true)
32
- end
33
-
34
- private
35
-
36
- def pathname
37
- @pathname ||= base_path.join(@raw_path)
38
- end
39
-
40
- def base_path
41
- Pathname.new(File.join('spec', 'fixtures'))
42
- end
43
- end
44
- end
45
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RSpec
4
- module FileFixtures
5
- VERSION = '0.1.1'
6
- end
7
- end