acts_as_removable 0.9.5 → 1.0.0

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: b2e52df51683c7203a4a78ed2f72ce9b5c72d464
4
- data.tar.gz: 9a39dbee521544bdcdae76250996c6dcb12e1fbf
3
+ metadata.gz: 1fa206ffd887f93f41139a14651c3743e80b5c74
4
+ data.tar.gz: 2fb4a88e148d300436f2a24e5bfb8b25ec8f4ba6
5
5
  SHA512:
6
- metadata.gz: 6f16a0de9785d79ffd75790c7b4872e6d7119fc9afc474547fa3aaaa6815e95e2de6e0bc5dbe12384d43864c29e44d6c064649c2fe6cc3ebac76358f103cc9a7
7
- data.tar.gz: 4e0651c43989baa13f8624f58513ce2df8adbd8c2b55a75e99f983006c6669a9e9448168e5570cea926c2e131ad4d32ecd835fa6b4b7eef8f24647a6122bf1ed
6
+ metadata.gz: 1c56210aa89a186e4ac278302b2cc5ec58c95d86d60879a34b9a1c03f1f703eaa65b9a43701bf03b234362b5096fa1697da3fb3c6d910fac7673e1df5ed09ecc
7
+ data.tar.gz: e5893b0432d55638f884d6b6f264746c0cc22632929b76fa5b15e4994cd1327b1a38e699d08ee3be0b8642bc5645067c7ce16cd9d0474ed9d0bf7c93dcf8ea36
data/.travis.yml CHANGED
@@ -2,3 +2,6 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - 2.1.0
6
+ - 2.1.1
7
+ - 2.1.2
data/README.md CHANGED
@@ -37,10 +37,10 @@ class MyModel < ActiveRecord::Base
37
37
  end
38
38
  ```
39
39
 
40
- It's possible to skip the default_scope:
40
+ It's possible to add a default scope with the active (not removed) records:
41
41
  ```ruby
42
42
  class MyModel < ActiveRecord::Base
43
- acts_as_removable without_default_scope: true
43
+ acts_as_removable with_default_scope: true
44
44
  end
45
45
  ```
46
46
 
@@ -10,12 +10,12 @@ module ActsAsRemovable
10
10
  #
11
11
  # acts_as_removable
12
12
  # acts_as_removable column_name: 'other_column_name'
13
- # acts_as_removable without_default_scope: true
13
+ # acts_as_removable with_default_scope: true
14
14
  #
15
15
  # ===== Options
16
16
  #
17
17
  # * <tt>:column_name</tt> - A symbol or string with the column to use for removal timestamp.
18
- # * <tt>:without_default_scope</tt> - A boolean indicating to not set a default scope.
18
+ # * <tt>:with_default_scope</tt> - A boolean indicating to set a default scope with only active (not removed) records
19
19
  def acts_as_removable(options = {})
20
20
  _acts_as_removable_options.merge!(options)
21
21
 
@@ -31,7 +31,7 @@ module ActsAsRemovable
31
31
  _removable_where_values(query, removed_at_column_name, all.table[removed_at_column_name].not_eq(nil).to_sql)
32
32
  }
33
33
 
34
- default_scope -> {where(all.table[_acts_as_removable_options[:column_name]].eq(nil).to_sql)} unless _acts_as_removable_options[:without_default_scope]
34
+ default_scope -> {where(all.table[_acts_as_removable_options[:column_name]].eq(nil).to_sql)} if _acts_as_removable_options[:with_default_scope]
35
35
 
36
36
  define_model_callbacks :remove, :unremove
37
37
 
@@ -1,3 +1,3 @@
1
1
  module ActsAsRemovable
2
- VERSION = '0.9.5'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe 'acts_as_removable' do
4
4
  class MyModel < ActiveRecord::Base
5
- acts_as_removable
5
+ acts_as_removable with_default_scope: true
6
6
  attr_accessor :callback_before_remove, :callback_after_remove, :callback_before_unremove, :callback_after_unremove
7
7
  before_remove do |r|
8
8
  r.callback_before_remove = true
@@ -20,7 +20,7 @@ describe 'acts_as_removable' do
20
20
  end
21
21
 
22
22
  class MySecondModel < ActiveRecord::Base
23
- acts_as_removable column_name: :use_this_column, without_default_scope: true
23
+ acts_as_removable column_name: :use_this_column
24
24
  end
25
25
 
26
26
  before do
@@ -44,12 +44,12 @@ describe 'acts_as_removable' do
44
44
 
45
45
  it 'test column and check method' do
46
46
  [[MyModel.create!, :removed_at], [MySecondModel.create!, :use_this_column]].each do |r, column_name|
47
- r.removed?.should be_false
48
- r.send(column_name).should be_nil
47
+ expect(r.removed?).to be(false)
48
+ expect(r.send(column_name)).to be(nil)
49
49
 
50
50
  r.remove
51
- r.removed?.should be_true
52
- r.send(column_name).should be_a(Time)
51
+ expect(r.removed?).to be(true)
52
+ expect(r.send(column_name)).to be_kind_of(Time)
53
53
  end
54
54
  end
55
55
 
@@ -62,36 +62,36 @@ describe 'acts_as_removable' do
62
62
  MySecondModel.create!
63
63
  MySecondModel.create!.remove!
64
64
 
65
- MyModel.count.to_i.should be(1)
66
- MyModel.actives.count.should be(1)
67
- MyModel.removed.count.should be(1)
68
- MyModel.unscoped.count.should be(2)
65
+ expect(MyModel.count).to be(1)
66
+ expect(MyModel.actives.count).to be(1)
67
+ expect(MyModel.removed.count).to be(1)
68
+ expect(MyModel.unscoped.count).to be(2)
69
69
 
70
- MySecondModel.count.to_i.should be(2)
71
- MySecondModel.actives.count.should be(1)
72
- MySecondModel.removed.count.should be(1)
73
- MySecondModel.unscoped.count.should be(2)
70
+ expect(MySecondModel.count).to be(2)
71
+ expect(MySecondModel.actives.count).to be(1)
72
+ expect(MySecondModel.removed.count).to be(1)
73
+ expect(MySecondModel.unscoped.count).to be(2)
74
74
  end
75
75
 
76
76
  it 'test callbacks' do
77
77
  r = MyModel.create!
78
- r.callback_before_remove.should be_false
79
- r.callback_after_remove.should be_false
80
- r.callback_before_unremove.should be_false
81
- r.callback_after_unremove.should be_false
78
+ expect(r.callback_before_remove).to be(nil)
79
+ expect(r.callback_after_remove).to be(nil)
80
+ expect(r.callback_before_unremove).to be(nil)
81
+ expect(r.callback_after_unremove).to be(nil)
82
82
 
83
83
  r.remove
84
84
 
85
- r.callback_before_remove.should be_true
86
- r.callback_after_remove.should be_true
87
- r.callback_before_unremove.should be_false
88
- r.callback_after_unremove.should be_false
85
+ expect(r.callback_before_remove).to be(true)
86
+ expect(r.callback_after_remove).to be(true)
87
+ expect(r.callback_before_unremove).to be(nil)
88
+ expect(r.callback_after_unremove).to be(nil)
89
89
 
90
90
  r.unremove
91
91
 
92
- r.callback_before_remove.should be_true
93
- r.callback_after_remove.should be_true
94
- r.callback_before_unremove.should be_true
95
- r.callback_after_unremove.should be_true
92
+ expect(r.callback_before_remove).to be(true)
93
+ expect(r.callback_after_remove).to be(true)
94
+ expect(r.callback_before_unremove).to be(true)
95
+ expect(r.callback_after_unremove).to be(true)
96
96
  end
97
97
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_removable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Schwab
@@ -9,90 +9,90 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-02 00:00:00.000000000 Z
12
+ date: 2014-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>'
18
+ - - ">"
19
19
  - !ruby/object:Gem::Version
20
20
  version: 4.0.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>'
25
+ - - ">"
26
26
  - !ruby/object:Gem::Version
27
27
  version: 4.0.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activerecord
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>'
32
+ - - ">"
33
33
  - !ruby/object:Gem::Version
34
34
  version: 4.0.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>'
39
+ - - ">"
40
40
  - !ruby/object:Gem::Version
41
41
  version: 4.0.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: bundler
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '1.3'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.3'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: sqlite3
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  description: Simplifies handling of pseudo removed records
@@ -102,9 +102,9 @@ executables: []
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
- - .gitignore
106
- - .ruby-version
107
- - .travis.yml
105
+ - ".gitignore"
106
+ - ".ruby-version"
107
+ - ".travis.yml"
108
108
  - Gemfile
109
109
  - LICENSE
110
110
  - README.md
@@ -124,17 +124,17 @@ require_paths:
124
124
  - lib
125
125
  required_ruby_version: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - '>='
127
+ - - ">="
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  requirements:
132
- - - '>='
132
+ - - ">="
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
- rubygems_version: 2.2.2
137
+ rubygems_version: 2.4.3
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Simplifies handling of pseudo removed records