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 +4 -4
- data/Gemfile.lock +2 -1
- data/README.md +1 -1
- data/lib/rspec/file_fixtures.rb +1 -21
- data/lib/rspec_file_fixtures.rb +22 -0
- data/lib/rspec_file_fixtures/fixture.rb +43 -0
- data/lib/rspec_file_fixtures/version.rb +5 -0
- data/rspec-file_fixtures.gemspec +3 -2
- metadata +19 -4
- data/lib/rspec/file_fixtures/fixture.rb +0 -45
- data/lib/rspec/file_fixtures/version.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e51ee7e50f2412ff8871adab3182e5e04c70dd3a6aca3c043f7bc8ce8ced4a8
|
4
|
+
data.tar.gz: d5cf13e34b08bbbc0d44bf8608d9f77a9720d0c0fee9c5d48dd45dd6cf952d71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6a3ab956acd7209e4cf552f67d748841d2342aae85259c6163c666490e6e966ecd03913428f1e7cc8386a5b92c39e11402e6c5db35f1803901947223adc8911
|
7
|
+
data.tar.gz: 076a5a07bbe0bc6e0e78ade9833478487743ad58658fa9e1b6a9fb2d590e579b70770a861c2807f173083c1f2f60fbe25942aea6ad094701dc0b4c6d65645f5f
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/rspec/file_fixtures.rb
CHANGED
@@ -1,23 +1,3 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
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
|
data/rspec-file_fixtures.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative 'lib/
|
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 =
|
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.
|
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/
|
33
|
-
- lib/
|
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
|