mongoid-multitenancy 1.1.2 → 1.1.3

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: 5fbe595c3d525a08bfe506d7c116dde5c8928885
4
- data.tar.gz: 27764ffe6c0c8096b5c7b17eace5c318c0a8037e
3
+ metadata.gz: 30fa52034535ce4524481877d5b9e048e1eeeaa5
4
+ data.tar.gz: 533f4f95ecb750443629027cac6d0dd9edc6bb73
5
5
  SHA512:
6
- metadata.gz: 125f068d3618a1184254e2464719e8ac98b5bff432df29bdfebbc931fb5fb969317a93f2f3348d761e92ceef3f2d6735ef1234c69cfe780a91dd7e19fe02d3c1
7
- data.tar.gz: 7d134e70413887e1f362e0727327f92ad8d2a713823512ee77d9be1af44c9fda8274a78b83268a053804f41a9ad4593ced7744d1204258e446a300ee43d05834
6
+ metadata.gz: efb3239aa595fe974954364f1b8b7cf2b0bb061d87dac50166294f54a219ed97b68504deead534086576016e840d38b125612a64d12a429d3b37c19ef90deb6a
7
+ data.tar.gz: f3a64574e2ef09ade685ab061806bd37885286ead3efe20d884887d14e42ab748e712a1635b9fc2724aa6bb520d614684e70b973bf4952b2866bad396e2125fd
data/.travis.yml CHANGED
@@ -3,9 +3,8 @@ rvm:
3
3
  - 2.0.0
4
4
  - 2.1.0
5
5
  - 2.2.0
6
- - ruby-head
6
+ - 2.3.0
7
7
  - jruby
8
- - jruby-head
9
8
  gemfile:
10
9
  - gemfiles/Gemfile.mongoid-4.0
11
10
  - gemfiles/Gemfile.mongoid-5.0
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ gem 'mongoid', '~> 5.0'
5
5
  gem 'rake', '~> 10.0'
6
6
 
7
7
  group :test do
8
+ gem 'database_cleaner', github: 'DatabaseCleaner/database_cleaner', ref: '1cab518'
8
9
  gem 'coveralls', require: false
9
10
  gem 'rspec', '~> 3.1'
10
11
  gem 'yard', '~> 0.8'
@@ -5,6 +5,7 @@ gem 'mongoid', '~> 4.0'
5
5
  gem 'rake', '~> 10.0'
6
6
 
7
7
  group :test do
8
+ gem 'database_cleaner', github: 'DatabaseCleaner/database_cleaner', ref: '1cab518'
8
9
  gem 'coveralls', :require => false
9
10
  gem 'rspec', '~> 3.1'
10
11
  gem 'yard', '~> 0.8'
@@ -5,6 +5,7 @@ gem 'mongoid', '~> 5.0'
5
5
  gem 'rake', '~> 10.0'
6
6
 
7
7
  group :test do
8
+ gem 'database_cleaner', github: 'DatabaseCleaner/database_cleaner', ref: '1cab518'
8
9
  gem 'coveralls', :require => false
9
10
  gem 'rspec', '~> 3.1'
10
11
  gem 'yard', '~> 0.8'
@@ -120,7 +120,7 @@ module Mongoid
120
120
  def define_initializer(association)
121
121
  # Apply the default value when the default scope is complex (optional tenant)
122
122
  after_initialize lambda {
123
- if Multitenancy.current_tenant && send(association.to_sym).nil? && new_record?
123
+ if Multitenancy.current_tenant && new_record?
124
124
  send "#{association}=".to_sym, Multitenancy.current_tenant
125
125
  end
126
126
  }
@@ -1,6 +1,6 @@
1
1
  module Mongoid
2
2
  module Multitenancy
3
3
  # Version
4
- VERSION = '1.1.2'
4
+ VERSION = '1.1.3'
5
5
  end
6
6
  end
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,7 @@ MODELS = File.join(File.dirname(__FILE__), 'models')
2
2
 
3
3
  require 'simplecov'
4
4
  require 'coveralls'
5
+ require 'database_cleaner'
5
6
 
6
7
  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
7
8
  SimpleCov::Formatter::HTMLFormatter,
@@ -21,7 +22,6 @@ elsif Mongoid::VERSION.start_with? '4'
21
22
  end
22
23
 
23
24
  require_relative 'support/shared_examples'
24
- require_relative 'support/database_cleaner'
25
25
  require_relative 'support/mongoid_matchers'
26
26
 
27
27
  Dir["#{MODELS}/*.rb"].each { |f| require f }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-multitenancy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aymeric Brisse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-20 00:00:00.000000000 Z
11
+ date: 2016-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -64,7 +64,6 @@ files:
64
64
  - spec/mutable_spec.rb
65
65
  - spec/optional_spec.rb
66
66
  - spec/spec_helper.rb
67
- - spec/support/database_cleaner.rb
68
67
  - spec/support/mongoid_matchers.rb
69
68
  - spec/support/shared_examples.rb
70
69
  homepage: https://github.com/PerfectMemory/mongoid-multitenancy
@@ -108,7 +107,6 @@ test_files:
108
107
  - spec/mutable_spec.rb
109
108
  - spec/optional_spec.rb
110
109
  - spec/spec_helper.rb
111
- - spec/support/database_cleaner.rb
112
110
  - spec/support/mongoid_matchers.rb
113
111
  - spec/support/shared_examples.rb
114
112
  has_rdoc:
@@ -1,36 +0,0 @@
1
- class DatabaseCleaner
2
- class << self
3
- def clean
4
- new.clean
5
- end
6
- end
7
-
8
- def clean
9
- if mongoid4?
10
- collections.each { |c| database[c].find.remove_all }
11
- else
12
- collections.each { |c| database[c].find.delete_many }
13
- end
14
- end
15
-
16
- private
17
-
18
- def mongoid4?
19
- Mongoid::VERSION.start_with? '4'
20
- end
21
-
22
- def database
23
- if mongoid4?
24
- Mongoid.default_session
25
- else
26
- Mongoid::Clients.default
27
- end
28
- end
29
-
30
- def collections
31
- database['system.namespaces'].find(name: { '$not' => /\.system\.|\$/ }).to_a.map do |collection|
32
- _, name = collection['name'].split('.', 2)
33
- name
34
- end
35
- end
36
- end