mongoid-fixture_set 1.3.0 → 1.3.1

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
  SHA1:
3
- metadata.gz: 3f8d0e4ca3845297cbc4d603eb34e7498f6472c5
4
- data.tar.gz: 2cbc44d1a2aac525c1d6741f03edcece4f9dceca
3
+ metadata.gz: 0c3af72edf54ab925487f291330a4bc18c2448ca
4
+ data.tar.gz: 1ba02a5102274cca576ac9bd985a40fce5156f0f
5
5
  SHA512:
6
- metadata.gz: c8faf0c64f4475fcabb706e78b45dbafd36c933281ea8b693e6b853fbbc0a92d04958d09f4b5e00fdc5884fb03f68e69b2052350e63ab47b95f0c4345272ffcd
7
- data.tar.gz: 4536e3e4d4597db95ab88e3c77dad7cebdcb82d6d2c8be16ed49458b073e5866f1984b6240f769f9fa1e80bfb5d589eeeb12bd407286d76c9357920f52f3bdeb
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 @@fixtures_loaded && self.class.load_fixtures_once && !Mongoid::FixtureSet.cache_empty?
71
+ if self.class.cached_fixtures && self.class.load_fixtures_once
71
72
  self.class.fixtures(:all)
72
- self.loaded_fixtures = Mongoid::FixtureSet.cached_fixtures
73
+ @loaded_fixtures = self.class.cached_fixtures
73
74
  else
74
75
  Mongoid::FixtureSet.reset_cache
75
76
  self.loaded_fixtures = load_fixtures
76
- @@fixtures_loaded = true
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 unless self.class.load_fixtures_once
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
@@ -1,6 +1,6 @@
1
1
  module Mongoid
2
2
  class FixtureSet
3
- VERSION = '1.3.0'
3
+ VERSION = '1.3.1'
4
4
  end
5
5
  end
6
6
 
@@ -5,6 +5,7 @@ print:
5
5
  name: Print
6
6
  users:
7
7
  - user1
8
+ - user 2é
8
9
  group1:
9
10
  name: Margot
10
11
  main_users:
@@ -18,7 +18,7 @@ user1:
18
18
  address:
19
19
  city: Strasbourg
20
20
  real: true
21
- user2:
21
+ user 2é:
22
22
  firstname: user2
23
23
  main_group:
24
24
  name: Win?
@@ -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 2, print.users.count
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.0
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