inheritable_fixtures 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/.travis.yml +4 -1
- data/Appraisals +17 -6
- data/README.md +9 -9
- data/gemfiles/rails40.gemfile +2 -1
- data/gemfiles/rails41.gemfile +2 -1
- data/gemfiles/rails42.gemfile +2 -1
- data/gemfiles/rails4252.gemfile +12 -0
- data/gemfiles/rails4271.gemfile +12 -0
- data/gemfiles/rails506.gemfile +12 -0
- data/inheritable_fixtures.gemspec +12 -12
- data/lib/inheritable_fixtures/rails_extensions/engine.rb +2 -2
- data/lib/inheritable_fixtures/rails_extensions/engine_configuration.rb +0 -2
- data/lib/inheritable_fixtures/rails_extensions/test_fixtures.rb +9 -9
- data/lib/inheritable_fixtures/version.rb +1 -1
- metadata +19 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 788ed43e1482ff2e8ce7e5c72a2626873eb02060602aa93efde446ed329c1f16
|
4
|
+
data.tar.gz: 6e732512ba083a0b5064445de6aa039d93341d3811e276796c7a6702a61e1558
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8da8b0a7a4e6b3d79385d4753b2cdeb6a6304505a157cf3baff7facf68aab8f82f83e505a05913a6ab6308a4388c9003958b0d518ad605b6955946387e295e2f
|
7
|
+
data.tar.gz: d48155b0baffcbbf936e9e8851cfc948b9a686f6b3870c866af51c175f0e9e47e3b3315ec1e8960707d52c011f2e29a5cc552c8a040001a069c9b3e5b15de904
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.3.3
|
data/.travis.yml
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.1.5
|
4
3
|
- 2.2.2
|
4
|
+
- 2.3.3
|
5
5
|
script:
|
6
6
|
- RAILS_ENV=test bundle exec rake --trace db:create db:migrate test
|
7
7
|
gemfile:
|
8
8
|
- gemfiles/rails40.gemfile
|
9
9
|
- gemfiles/rails41.gemfile
|
10
10
|
- gemfiles/rails42.gemfile
|
11
|
+
- gemfiles/rails4252.gemfile
|
12
|
+
- gemfiles/rails4271.gemfile
|
13
|
+
- gemfiles/rails506.gemfile
|
data/Appraisals
CHANGED
@@ -1,10 +1,21 @@
|
|
1
|
-
appraise
|
2
|
-
gem
|
1
|
+
appraise 'rails40' do
|
2
|
+
gem 'rails', '4.0.13'
|
3
3
|
end
|
4
|
-
appraise
|
5
|
-
gem
|
4
|
+
appraise 'rails41' do
|
5
|
+
gem 'rails', '4.1.12'
|
6
6
|
end
|
7
|
-
appraise
|
8
|
-
gem
|
7
|
+
appraise 'rails42' do
|
8
|
+
gem 'rails', '4.2.1'
|
9
|
+
end
|
10
|
+
appraise 'rails4252' do
|
11
|
+
gem 'rails', '4.2.5.2'
|
12
|
+
end
|
13
|
+
appraise 'rails4271' do
|
14
|
+
gem 'rails', '4.2.7.1'
|
9
15
|
end
|
10
16
|
|
17
|
+
if RUBY_VERSION == '2.2.2' || RUBY_VERSION == '2.3.3'
|
18
|
+
appraise 'rails506' do
|
19
|
+
gem 'rails', '5.0.6'
|
20
|
+
end
|
21
|
+
end
|
data/README.md
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
[![GitHub version](https://badge.fury.io/gh/appfolio%2Finheritable_fixtures.svg)](http://badge.fury.io/gh/appfolio%2Finheritable_fixtures)
|
4
4
|
[![Build Status](https://travis-ci.org/appfolio/inheritable_fixtures.svg?branch=master)](https://travis-ci.org/appfolio/inheritable_fixtures)
|
5
5
|
|
6
|
-
Allows Rails
|
6
|
+
Allows Rails engines to contain fixtures for their models and for those fixtures to be automatically used in the downstream engines. This is very much in line with Rails engines containing db migrations for their models and for those [migrations to be automatically used by the downstream engines](http://pivotallabs.com/leave-your-migrations-in-your-rails-engines/).
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
10
|
-
Add this line to your application's Gemfile
|
10
|
+
Add this line to your application's `Gemfile`:
|
11
11
|
|
12
12
|
```ruby
|
13
13
|
gem 'inheritable_fixtures'
|
@@ -15,25 +15,25 @@ gem 'inheritable_fixtures'
|
|
15
15
|
|
16
16
|
And then execute:
|
17
17
|
|
18
|
-
$ bundle
|
18
|
+
$ bundle install
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
-
This gem introduces a configuration option called `Rails.application.config.fixtures_paths`, which is by default empty. The list of fixtures is determined by traversing all the `fixtures_paths` looking for fixture files.
|
22
|
+
This gem introduces a configuration option called `Rails.application.config.fixtures_paths`, which is by default empty. The list of fixtures is determined by traversing all the `fixtures_paths` looking for fixture files. `Rails.root.join('test/fixtures')` is always prepended to the list, thus it has the highest precedence.
|
23
23
|
|
24
|
-
When the application initializes, each engine adds `
|
24
|
+
When the application initializes, each engine adds `lib/fixtures` to the list (if that path exists).
|
25
25
|
|
26
26
|
### fixtures :all
|
27
27
|
|
28
|
-
Tests use `fixtures :all` or `fixtures :users, :addresses` to initial the database with necessary test data.
|
28
|
+
Tests use `fixtures :all` or something like `fixtures :users, :addresses` to initial the database with necessary test data. It will now search for the fixtures in all `fixtures_paths`.
|
29
29
|
|
30
|
-
###
|
30
|
+
### fixture\_file\_upload
|
31
31
|
|
32
|
-
The `fixture_file_upload` is a handy utility provided by Rails
|
32
|
+
The `fixture_file_upload` is a handy utility provided by Rails for creating `Rack::Test::UploadedFile` out of a fixture file. It will now look for the fixture in all `fixtures_paths`.
|
33
33
|
|
34
34
|
### rake db:fixtures:load
|
35
35
|
|
36
|
-
The `db:fixtures:load` task is used to populate a database with the fixtures.
|
36
|
+
The `db:fixtures:load` task is used to populate a database with the fixtures. It will now load all fixtures from `fixtures_paths`.
|
37
37
|
|
38
38
|
## Contributing
|
39
39
|
|
data/gemfiles/rails40.gemfile
CHANGED
data/gemfiles/rails41.gemfile
CHANGED
data/gemfiles/rails42.gemfile
CHANGED
@@ -2,21 +2,21 @@
|
|
2
2
|
require_relative 'lib/inheritable_fixtures/version'
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
|
-
spec.name
|
6
|
-
spec.version
|
7
|
-
spec.authors
|
8
|
-
spec.email
|
5
|
+
spec.name = 'inheritable_fixtures'
|
6
|
+
spec.version = InheritableFixtures::VERSION
|
7
|
+
spec.authors = ['AppFolio, Inc.']
|
8
|
+
spec.email = ['dev@appfolio.com']
|
9
9
|
|
10
10
|
spec.required_ruby_version = '>= 2.0.0'
|
11
11
|
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
14
|
-
spec.license
|
12
|
+
spec.summary = %q{Inherit Rails fixtures}
|
13
|
+
spec.description = %q{Allows fixtures from Rails engines to be inherited by downstream engines and the enclosing Rails app}
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
|
-
spec.files
|
17
|
-
spec.bindir
|
18
|
-
spec.executables
|
19
|
-
spec.require_paths = [
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/})}
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f)}
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency
|
21
|
+
spec.add_dependency 'rails', ['>= 4.0', '< 5.1']
|
22
22
|
end
|
@@ -8,9 +8,9 @@ module InheritableFixtures
|
|
8
8
|
# paths.add('lib/fixtures')
|
9
9
|
#
|
10
10
|
# and remove EngineConfiguration
|
11
|
-
|
11
|
+
|
12
12
|
initializer :append_fixtures_paths, group: :all do |app|
|
13
|
-
app.config.fixtures_paths.unshift(*paths[
|
13
|
+
app.config.fixtures_paths.unshift(*paths['lib/fixtures'].existent_directories)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module InheritableFixtures
|
2
2
|
module RailsExtensions
|
3
3
|
module TestFixtures
|
4
|
-
|
4
|
+
|
5
5
|
def included(target)
|
6
6
|
super
|
7
7
|
target.send(:include, InstanceMethods)
|
@@ -11,12 +11,12 @@ module InheritableFixtures
|
|
11
11
|
self.fixture_table_names_per_path = {}
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
module ClassMethods
|
16
16
|
def fixtures(*fixture_set_names)
|
17
17
|
original_fixture_path = self.fixture_path
|
18
18
|
|
19
|
-
paths = ([
|
19
|
+
paths = ([self.fixture_path] + Rails.application.config.fixtures_paths)
|
20
20
|
paths.each do |path|
|
21
21
|
self.fixture_path = path
|
22
22
|
self.fixture_table_names = []
|
@@ -24,29 +24,29 @@ module InheritableFixtures
|
|
24
24
|
self.fixture_table_names_per_path[path] = self.fixture_table_names
|
25
25
|
end
|
26
26
|
|
27
|
-
ensure
|
27
|
+
ensure
|
28
28
|
self.fixture_path = original_fixture_path
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
module InstanceMethods
|
33
33
|
private
|
34
34
|
|
35
35
|
def load_fixtures(*args)
|
36
|
-
if defined?(ActiveRecord::FixtureSet) #
|
36
|
+
if defined?(ActiveRecord::FixtureSet) # Rails 4+
|
37
37
|
fixtures_class = ActiveRecord::FixtureSet
|
38
38
|
end
|
39
39
|
raise "do not know how to monkey patch fixtures .. what version of rails are you using?" unless fixtures_class
|
40
40
|
|
41
41
|
fixtures = []
|
42
42
|
fixture_table_names_per_path.each do |fixture_path, fixture_table_names|
|
43
|
-
fixture_args = [
|
43
|
+
fixture_args = [fixture_path, fixture_table_names, fixture_class_names] + args
|
44
44
|
fixtures += fixtures_class.create_fixtures(*fixture_args)
|
45
45
|
end
|
46
|
-
Hash[fixtures.map {
|
46
|
+
Hash[fixtures.map {|f| [f.name, f]}]
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
metadata
CHANGED
@@ -1,32 +1,39 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inheritable_fixtures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- AppFolio, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.1'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '4.0'
|
27
|
-
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.1'
|
33
|
+
description: Allows fixtures from Rails engines to be inherited by downstream engines
|
34
|
+
and the enclosing Rails app
|
28
35
|
email:
|
29
|
-
-
|
36
|
+
- dev@appfolio.com
|
30
37
|
executables: []
|
31
38
|
extensions: []
|
32
39
|
extra_rdoc_files: []
|
@@ -43,6 +50,9 @@ files:
|
|
43
50
|
- gemfiles/rails40.gemfile
|
44
51
|
- gemfiles/rails41.gemfile
|
45
52
|
- gemfiles/rails42.gemfile
|
53
|
+
- gemfiles/rails4252.gemfile
|
54
|
+
- gemfiles/rails4271.gemfile
|
55
|
+
- gemfiles/rails506.gemfile
|
46
56
|
- inheritable_fixtures.gemspec
|
47
57
|
- lib/inheritable_fixtures.rb
|
48
58
|
- lib/inheritable_fixtures/engine.rb
|
@@ -73,8 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
83
|
version: '0'
|
74
84
|
requirements: []
|
75
85
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.
|
86
|
+
rubygems_version: 2.7.4
|
77
87
|
signing_key:
|
78
88
|
specification_version: 4
|
79
|
-
summary:
|
89
|
+
summary: Inherit Rails fixtures
|
80
90
|
test_files: []
|