mongoid-fixture_set 1.3.0 → 1.3.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c3af72edf54ab925487f291330a4bc18c2448ca
|
4
|
+
data.tar.gz: 1ba02a5102274cca576ac9bd985a40fce5156f0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 733c4120fdbe665b8d592e8f6935758244ad447af60e53dfddecf937bbcb462168d3dd2d238655db17044e287daf72b84b87cdd5fb7211ce3d595c69d86e80ae
|
7
|
+
data.tar.gz: 1ac9ec6b4d9f5ec0e7b8ae163308eef668e26e69984a64ccc2bc7775b4f92ea3e6af7ddb6f6763660c8084127436604ad88dd6fd8ce64f4dfbb76474db8177d6
|
@@ -19,9 +19,11 @@ module Mongoid
|
|
19
19
|
class_attribute :fixture_path, :instance_writer => false
|
20
20
|
class_attribute :fixture_set_names
|
21
21
|
class_attribute :load_fixtures_once
|
22
|
+
class_attribute :cached_fixtures
|
22
23
|
|
23
24
|
self.fixture_set_names = []
|
24
25
|
self.load_fixtures_once = false
|
26
|
+
self.cached_fixtures = nil
|
25
27
|
end
|
26
28
|
|
27
29
|
module ClassMethods
|
@@ -65,21 +67,19 @@ module Mongoid
|
|
65
67
|
|
66
68
|
def setup_fixtures
|
67
69
|
@fixture_cache = {}
|
68
|
-
@@fixtures_loaded ||= false
|
69
70
|
|
70
|
-
if
|
71
|
+
if self.class.cached_fixtures && self.class.load_fixtures_once
|
71
72
|
self.class.fixtures(:all)
|
72
|
-
|
73
|
+
@loaded_fixtures = self.class.cached_fixtures
|
73
74
|
else
|
74
75
|
Mongoid::FixtureSet.reset_cache
|
75
76
|
self.loaded_fixtures = load_fixtures
|
76
|
-
|
77
|
-
@loaded_fixtures
|
77
|
+
self.class.cached_fixtures = @loaded_fixtures
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
def teardown_fixtures
|
82
|
-
Mongoid::FixtureSet.reset_cache
|
82
|
+
Mongoid::FixtureSet.reset_cache
|
83
83
|
end
|
84
84
|
|
85
85
|
private
|
@@ -93,7 +93,7 @@ module Mongoid
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def loaded_fixtures=(fixtures)
|
96
|
-
@loaded_fixtures = Hash[fixtures.map { |f| [f.name, f] }]
|
96
|
+
@loaded_fixtures = Hash[fixtures.dup.map { |f| [f.name, f] }]
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
data/test/fixtures/groups.yml
CHANGED
data/test/fixtures/users.yml
CHANGED
@@ -67,7 +67,7 @@ module Mongoid
|
|
67
67
|
|
68
68
|
assert_equal 1, user1.homes.count
|
69
69
|
assert_equal geoffroy, f_geoffroy.find
|
70
|
-
assert_equal
|
70
|
+
assert_equal 3, print.users.count
|
71
71
|
assert print.users.include?(geoffroy)
|
72
72
|
assert print.users.include?(user1)
|
73
73
|
assert sudoers.main_users.include?(geoffroy)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-fixture_set
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffroy Planquart
|
@@ -61,9 +61,9 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- lib/mongoid/fixture_set/errors.rb
|
63
63
|
- lib/mongoid/fixture_set/file.rb
|
64
|
-
- lib/mongoid/fixture_set/class_cache.rb
|
65
|
-
- lib/mongoid/fixture_set/test_helper.rb
|
66
64
|
- lib/mongoid/fixture_set/fixture.rb
|
65
|
+
- lib/mongoid/fixture_set/test_helper.rb
|
66
|
+
- lib/mongoid/fixture_set/class_cache.rb
|
67
67
|
- lib/mongoid/fixture_set/version.rb
|
68
68
|
- lib/mongoid/fixture_set.rb
|
69
69
|
- lib/mongoid-fixture_set.rb
|
@@ -81,12 +81,12 @@ files:
|
|
81
81
|
- test/models/user.rb
|
82
82
|
- test/models/item.rb
|
83
83
|
- test/mongoid.yml
|
84
|
-
- test/fixtures/groups.yml
|
85
84
|
- test/fixtures/schools.yml
|
86
85
|
- test/fixtures/organisations.yml
|
87
86
|
- test/fixtures/users/family.yml
|
88
87
|
- test/fixtures/not_models.yml
|
89
88
|
- test/fixtures/users.yml
|
89
|
+
- test/fixtures/groups.yml
|
90
90
|
- test/test_helper.rb
|
91
91
|
- test/load_once_fixtures/tests.yml
|
92
92
|
- test/nested_polymorphic_relation_fixtures/groups.yml
|
@@ -127,12 +127,12 @@ test_files:
|
|
127
127
|
- test/models/user.rb
|
128
128
|
- test/models/item.rb
|
129
129
|
- test/mongoid.yml
|
130
|
-
- test/fixtures/groups.yml
|
131
130
|
- test/fixtures/schools.yml
|
132
131
|
- test/fixtures/organisations.yml
|
133
132
|
- test/fixtures/users/family.yml
|
134
133
|
- test/fixtures/not_models.yml
|
135
134
|
- test/fixtures/users.yml
|
135
|
+
- test/fixtures/groups.yml
|
136
136
|
- test/test_helper.rb
|
137
137
|
- test/load_once_fixtures/tests.yml
|
138
138
|
- test/nested_polymorphic_relation_fixtures/groups.yml
|