fixturize 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fixturize.rb +12 -10
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62a329addf4e8f7170727de9a13ab77ee939b9bc
4
- data.tar.gz: 40a7a2359de3a3d267ef131d074b7590617b3fb0
3
+ metadata.gz: c6b35e34022bad9e7c2219f5d246b213dcfbbecb
4
+ data.tar.gz: 61577b83f233220ddf5987784199d71b430bd240
5
5
  SHA512:
6
- metadata.gz: 9e7266619c26ad5aa91133cc4a9cc36b122fd5e6ca32ae6eff409bb10f915d6415e03f4af44f2820cfe40b0bec22c90f57d7c6bf6448e609a56a82ca89ac52d2
7
- data.tar.gz: 5d6d1e8780c85e4eb84dce7036f9074c5498a5f31e677858b15c820bd2476b76e10f0a5b844db193e08741afbdf3b5ade0e54ed876b28fd75a946eef32dd1d24
6
+ metadata.gz: 8cbfaf5ea7e20fed5b139ca0b4bfcabe10c5da384368806bec7b481799bb1d09d0a44de94358f637f39252953d5baf1078e53c7d564a469179e802677be93b04
7
+ data.tar.gz: 35047bc2a104ceba398ec73c5294588e6f71b18f9bb6fbbe67c06f680fe31e8d22e632f42994898ac1bfd30a7d11aac8a88c1b82c9aa8ab495bf2c73f64cea8f
data/lib/fixturize.rb CHANGED
@@ -82,7 +82,10 @@ class Fixturize
82
82
  def index!
83
83
  return unless enabled?
84
84
 
85
- collection.ensure_index({ :name => Mongo::ASCENDING, :type => Mongo::ASCENDING, :timestamp => Mongo::ASCENDING })
85
+ collection.ensure_index({
86
+ :name => Mongo::ASCENDING,
87
+ :type => Mongo::ASCENDING,
88
+ })
86
89
  end
87
90
 
88
91
  def fixture_name(name = nil, &block)
@@ -115,11 +118,13 @@ class Fixturize
115
118
  name = fixture_name(name, &block)
116
119
  self.current_instrumentation = name
117
120
 
118
- db_instrumentations = collection.
119
- find({ :name => name, :type => INSTRUMENT_DATABASE }).
120
- sort({ :timestamp => Mongo::ASCENDING }).
121
+ all_instrumentations = collection.
122
+ find({ :name => name }).
123
+ sort({ :'$natural' => Mongo::ASCENDING }).
121
124
  to_a
122
125
 
126
+ db_instrumentations = all_instrumentations.select { |i| i['type'] == INSTRUMENT_DATABASE }
127
+
123
128
  if db_instrumentations.any?
124
129
  uninstall!
125
130
 
@@ -127,10 +132,7 @@ class Fixturize
127
132
  load_data_from(instrumentation)
128
133
  end
129
134
 
130
- ivar_instrumentations = collection.
131
- find({ :name => name, :type => INSTRUMENT_IVARS }).
132
- sort({ :timestamp => Mongo::ASCENDING }).
133
- to_a
135
+ ivar_instrumentations = all_instrumentations.select { |i| i['type'] == INSTRUMENT_IVARS }
134
136
 
135
137
  if ivar_instrumentations.any?
136
138
  ivar_instrumentations.each do |instrumentation|
@@ -149,7 +151,7 @@ class Fixturize
149
151
  :collection_name => collection_name.to_s,
150
152
  :method_name => method_name.to_s,
151
153
  :args => BSON::Binary.new(Marshal.dump(args)),
152
- :timestamp => Time.now.to_f
154
+ :timestamp => Time.now.to_f, # unused, just for reference
153
155
  # :json_args => args.to_json,
154
156
  })
155
157
  end
@@ -168,7 +170,7 @@ class Fixturize
168
170
  :ivar => ivar,
169
171
  :model => obj.class.to_s,
170
172
  :id => obj.id,
171
- :timestamp => Time.now.to_f
173
+ :timestamp => Time.now.to_f, # unused, just for reference
172
174
  })
173
175
  end
174
176
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixturize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Taylor
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-24 00:00:00.000000000 Z
12
+ date: 2017-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: method_source