temping 3.4.0 → 3.5.0

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/temping.rb +18 -12
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67ebb74f4b62c45ecd5bd6baec76e1ba73284d83
4
- data.tar.gz: 5bdfed95158838b3f00017e3d210d316e799c3a2
3
+ metadata.gz: f92d92121487913bed32cd4671b17b4a0994e084
4
+ data.tar.gz: ef135c7c09c1c0a00392558cd6ba7af2eb60ac53
5
5
  SHA512:
6
- metadata.gz: ff18c2a9e0896645e114370ec94bda2c21cfa8fd4d6d29dd3cacd32bd23447090084a3d3c84fcc6993a33196696bd8631b0bc069c7abfc5ba485cbfff468aac2
7
- data.tar.gz: 639ded7dd61bad695d7a69291176feb36439967a11624c18d6234c9ed68bdf659c4571d520e772ab5cc8770192e89f8f78807b98d936ef038e9c708a94df1911
6
+ metadata.gz: b92be9a6ec904abdb56adc5fd1f1060ee31f680ccd3d2c65152510c2631b16f5c1570722e163bd160a953a325a0d830a75eea36c2058d9d055a52341bd74b80b
7
+ data.tar.gz: 93f375e21e966c47e831448ecc4077975713cb09fa60f9aea9c5d40d591ed3e6ea76e05e020fc0439b9fab174a02a75af0d88166631f5c6cf4758775219097bc
data/lib/temping.rb CHANGED
@@ -4,21 +4,27 @@ require "active_support/core_ext/string"
4
4
  class Temping
5
5
  @model_klasses = []
6
6
 
7
- def self.create(model_name, options = {}, &block)
8
- factory = ModelFactory.new(model_name.to_s.classify, options, &block)
9
- klass = factory.klass
10
- @model_klasses << klass
11
- klass
12
- end
7
+ class << self
8
+ def create(model_name, options = {}, &block)
9
+ factory = ModelFactory.new(model_name.to_s.classify, options, &block)
10
+ klass = factory.klass
11
+ @model_klasses << klass
12
+ klass
13
+ end
13
14
 
14
- def self.teardown
15
- @model_klasses.each do |klass|
16
- if Object.const_defined?(klass.name)
17
- klass.connection.drop_table(klass.table_name)
18
- Object.send(:remove_const, klass.name)
15
+ def teardown
16
+ @model_klasses.each do |klass|
17
+ if Object.const_defined?(klass.name)
18
+ klass.connection.drop_table(klass.table_name)
19
+ Object.send(:remove_const, klass.name)
20
+ end
19
21
  end
22
+ @model_klasses.clear
23
+ end
24
+
25
+ def cleanup
26
+ @model_klasses.each(&:destroy_all)
20
27
  end
21
- @model_klasses.clear
22
28
  end
23
29
 
24
30
  class ModelFactory
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: temping
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Pignata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-23 00:00:00.000000000 Z
11
+ date: 2016-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord