acts_as_defaultable 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NWNiNGRlOTY1YzZhMzEzMzE4NTg0Y2RjYTRiZmQxMzYxNTA5ZWMzOA==
5
- data.tar.gz: !binary |-
6
- MmNjN2QzMzRjN2Q5ZjhlOTVlNDc3YTQ4NDdiOWI2ZmVkNjY3YjkzNA==
2
+ SHA1:
3
+ metadata.gz: d3c07b7c979b4d6fc886d29b71f7970a3e89b549
4
+ data.tar.gz: 88ed9fc097fe1e5ddc696661303cdea0539afe46
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MGVjMzEzNzk0ZmE5MjM3MDE3MTdmZTk5NzAxY2U0ZmY4ZDE2ZjY5MWViMWI3
10
- NTgyZTFjMTIyZGE3NjI1NzNmZTMwNzkzOWJhNDZiNTQ1NmNhMDUxZGY5M2Q3
11
- ZmZmZmQ3MDVlMzI0MjRlN2RmZjAzZmFkMTMzYWI1OTI2MDc3MWM=
12
- data.tar.gz: !binary |-
13
- MTNkZTVhYzMwZTJjOTk5NmVhMGMzM2IzMWU2YWM4YjY4YmJmZDk1MTBhOWE3
14
- NzJjYjZiZDUyOWFkZTE1OTk4OTkxZTFmNGEwMTE0ZDM1Y2QwNTNlOTU3ZDBk
15
- NDdhOGU2MGIwM2NlOGFjODczOTBlYmM4NzYwYjVhYWMwY2RkNzM=
6
+ metadata.gz: bbd13fa4634173d4e9d122e6edb88b7807c6d9240e3b758f5fe32c1e50bc29ee49de1d1b2c815f614ee5b02f0c4900cf5753a39cce316988f27d2714a7207b81
7
+ data.tar.gz: 85ec76f6f5f1b86c5d57201f9df470aa16bc2d9a2790bbd391c0d776531b16e0fc4af296b882cdfaa717a3e81e90fc0a25165233d5752f50ee9855e370beb95b
data/README.md CHANGED
@@ -2,12 +2,15 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/chief/acts_as_defaultable.png?branch=master)](https://travis-ci.org/chief/acts_as_defaultable)
4
4
  [![Code Climate](https://codeclimate.com/github/chief/acts_as_defaultable.png)](https://codeclimate.com/github/chief/acts_as_defaultable)
5
+ [![Gem Version](https://badge.fury.io/rb/acts_as_defaultable.png)](http://badge.fury.io/rb/acts_as_defaultable)
6
+ [![Dependency Status](https://gemnasium.com/chief/acts_as_defaultable.png)](https://gemnasium.com/chief/acts_as_defaultable)
5
7
 
6
8
  ## Description
7
9
 
8
10
  This ``acts_as`` extension provides the capability for having a default object.
9
11
  The class that has this specified needs to have a default column defined as an integer,
10
12
  string or boolean on the mapped database table.
13
+ There is also optional support for each record to have a default object of another model.
11
14
 
12
15
  ## Install
13
16
 
@@ -21,6 +24,8 @@ Currently is tested on rails3.2, ruby 1.9.3 and mysql
21
24
 
22
25
  ## Example
23
26
 
27
+ ### Default object
28
+
24
29
  ```ruby
25
30
  class Country < ActiveRecord::Base
26
31
  acts_as_defaultable :default
@@ -38,12 +43,63 @@ Currently is tested on rails3.2, ruby 1.9.3 and mysql
38
43
 
39
44
  If no options provided `default` column is assumed.
40
45
 
46
+ ### Default object for each record
47
+
48
+ ```ruby
49
+ class User < ActiveRecord::Base
50
+ acts_as_defaultable :default, relation: :post
51
+ end
52
+
53
+ class Post < ActiveRecord::Base
54
+ after_destroy User.new
55
+ end
56
+
57
+ class Comment < ActiveRecord::Base
58
+ end
59
+
60
+ user = User.new
61
+ post = Post.create
62
+ user.default_post = post
63
+ user.save
64
+ user.default_post == post # => true
65
+
66
+ post.destroy
67
+ user.reload
68
+ user.default_post == nil # => true
69
+
70
+ user.default_post = Comment.create
71
+ user.default_post == nil # => true
72
+ ```
73
+
74
+ Only an object of the relation class will be accepted.
75
+ The `after_destroy` callback is optional but will ensure that results stay consistent in the event
76
+ that a newly created **post** gets the same id as the one destroyed
77
+
41
78
  ## Notes
42
79
 
43
80
  The option to acts_as_defaultable is the `column` of the Model that defines default
44
81
  behaviour. This column can be a string, a boolean or an integer with default
45
82
  positive values 'on', true, 1 and default negative values 'off', false, 0 respectively.
46
83
 
84
+ The column name for a default relation is `default_column` _ `relation_column` and can be either a string or an integer.
85
+
86
+ Examples:
87
+
88
+ ```
89
+ class User < ActiveRecord::Base
90
+ acts_as_defaultable :default, relation: :post
91
+ end
92
+ ```
93
+
94
+ Column name in users table must be `default_post`
95
+
96
+ ```
97
+ class User < ActiveRecord::Base
98
+ acts_as_defaultable :unique, relation: :post
99
+ end
100
+ ```
101
+
102
+ Column name must be `unique_post`
47
103
 
48
104
  ## License
49
105
 
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency 'activesupport', ['>= 3.0.0']
24
24
  s.add_dependency 'activerecord', ['>= 3.0.0']
25
25
 
26
- s.add_development_dependency 'mysql2'
26
+ s.add_development_dependency 'sqlite3'
27
27
  s.add_development_dependency 'rails', ['= 3.2.16']
28
28
  s.add_development_dependency "rspec"
29
29
  s.add_development_dependency "rspec-rails"
@@ -8,14 +8,28 @@ module ActsAsDefaultable
8
8
 
9
9
  after_save :set_unique_default
10
10
 
11
- column = options.first.to_sym unless options.blank?
12
- column ||= :default
11
+ if options.size > 1
12
+ column = options.first
13
+ relation = options.second[:relation]
14
+ elsif options.first.is_a?(Hash)
15
+ relation = options.first[:relation]
16
+ else
17
+ column = options.first
18
+ end
19
+
20
+ column ||= :default
21
+ column = column.to_s
22
+ relation = relation.to_s
23
+ relation_column = column + '_' + relation
13
24
 
14
- puts "acts_as_defaultable: Specify a column #{column} in #{self.to_s}" unless self.column_names.include?(column.to_s)
25
+ puts "acts_as_defaultable: Specify a column #{column} in #{self}" unless column_names.include?(column)
26
+ if !relation.blank? && !column_names.include?(relation_column)
27
+ puts "acts_as_defaultable: Specify a column #{relation_column} in #{self}"
28
+ end
15
29
 
16
- if self.column_names.include?(column.to_s)
30
+ if column_names.include?(column)
17
31
  positive_value =
18
- case self.columns_hash[column.to_s].type
32
+ case columns_hash[column].type
19
33
  when :integer
20
34
  1
21
35
  when :boolean
@@ -25,7 +39,7 @@ module ActsAsDefaultable
25
39
  end
26
40
 
27
41
  negative_value =
28
- case self.columns_hash[column.to_s].type
42
+ case columns_hash[column].type
29
43
  when :integer
30
44
  0
31
45
  when :boolean
@@ -37,7 +51,11 @@ module ActsAsDefaultable
37
51
 
38
52
  class_methods = %(
39
53
  def self.default_column
40
- "#{column.to_sym}"
54
+ "#{column}"
55
+ end
56
+
57
+ def self.default_relation_column
58
+ "#{relation_column}"
41
59
  end
42
60
 
43
61
  def self.default_positive_value
@@ -54,11 +72,11 @@ module ActsAsDefaultable
54
72
  #{class_methods}
55
73
 
56
74
  def self.default
57
- self.all_defaults.first
75
+ all_defaults.first
58
76
  end
59
77
 
60
78
  def self.all_defaults
61
- where(self.default_column.to_sym => self.default_positive_value)
79
+ where(default_column => default_positive_value)
62
80
  end
63
81
 
64
82
  def set_unique_default
@@ -69,6 +87,19 @@ module ActsAsDefaultable
69
87
  end
70
88
  end
71
89
 
90
+ def #{relation_column}
91
+ Object.const_get("#{relation.classify}").find_by_id(read_attribute(self.class.default_relation_column))
92
+ end
93
+
94
+ def #{relation_column}=(obj)
95
+ default_relation_id = obj.instance_of?(#{relation.classify}) ? obj.id : 0
96
+ write_attribute(self.class.default_relation_column, default_relation_id)
97
+ end
98
+
99
+ def after_destroy(record)
100
+ self.class.where(self.class.default_relation_column => record.id).update_all(self.class.default_relation_column => 0)
101
+ end
102
+
72
103
  EOF
73
104
 
74
105
  end
@@ -1,3 +1,3 @@
1
1
  module ActsAsDefaultable
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -0,0 +1,4 @@
1
+ class Admin < ActiveRecord::Base
2
+ acts_as_defaultable :main, relation: :blog_post
3
+ end
4
+
@@ -0,0 +1,4 @@
1
+ class BlogPost < ActiveRecord::Base
2
+ after_destroy User.new, Admin.new
3
+ end
4
+
@@ -1,3 +1,3 @@
1
1
  class FailOne < ActiveRecord::Base
2
- acts_as_defaultable :epic
2
+ acts_as_defaultable :epic, relation: :blog_posts
3
3
  end
@@ -0,0 +1,4 @@
1
+ class User < ActiveRecord::Base
2
+ acts_as_defaultable relation: :blog_post
3
+ end
4
+
@@ -1,42 +1,13 @@
1
- # MySQL. Versions 4.1 and 5.0 are recommended.
2
- #
3
- # Install the MYSQL driver
4
- # gem install mysql2
5
- #
6
- # Ensure the MySQL gem is defined in your Gemfile
7
- # gem 'mysql2'
8
- #
9
- # And be sure to use new-style password hashing:
10
- # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
11
- development:
12
- adapter: mysql2
13
- encoding: utf8
14
- reconnect: false
15
- database: dummy_development
1
+ default: &default
2
+ adapter: sqlite3
16
3
  pool: 5
17
- username: root
18
- password:
19
- socket: /var/run/mysqld/mysqld.sock
4
+ timeout: 5000
5
+
6
+ development:
7
+ <<: *default
8
+ database: db/development.sqlite3
20
9
 
21
- # Warning: The database defined as "test" will be erased and
22
- # re-generated from your development database when you run "rake".
23
- # Do not set this db to the same as development or production.
24
10
  test:
25
- adapter: mysql2
26
- encoding: utf8
27
- reconnect: false
28
- database: dummy_test
29
- pool: 5
30
- username: root
31
- password:
32
- socket: /var/run/mysqld/mysqld.sock
11
+ <<: *default
12
+ database: db/test.sqlite3
33
13
 
34
- production:
35
- adapter: mysql2
36
- encoding: utf8
37
- reconnect: false
38
- database: dummy_production
39
- pool: 5
40
- username: root
41
- password:
42
- socket: /var/run/mysqld/mysqld.sock
@@ -0,0 +1,10 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+ t.boolean :default
6
+ t.integer :default_blog_post
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ class CreateBlogPosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :blog_posts do |t|
4
+ t.string :text
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
9
+
@@ -0,0 +1,11 @@
1
+ class CreateAdmins < ActiveRecord::Migration
2
+ def change
3
+ create_table :admins do |t|
4
+ t.string :name
5
+ t.boolean :main
6
+ t.string :main_blog_post
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
11
+
@@ -11,7 +11,15 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20120105110842) do
14
+ ActiveRecord::Schema.define(:version => 20150522160050) do
15
+
16
+ create_table "admins", :force => true do |t|
17
+ t.string "name"
18
+ t.boolean "main"
19
+ t.string "main_blog_post"
20
+ t.datetime "created_at", :null => false
21
+ t.datetime "updated_at", :null => false
22
+ end
15
23
 
16
24
  create_table "anothers", :force => true do |t|
17
25
  t.string "test"
@@ -20,23 +28,22 @@ ActiveRecord::Schema.define(:version => 20120105110842) do
20
28
  t.datetime "updated_at", :null => false
21
29
  end
22
30
 
23
- create_table "boolean_defaults", :force => true do |t|
24
- t.string "name"
25
- t.boolean "default"
31
+ create_table "blog_posts", :force => true do |t|
32
+ t.string "text"
26
33
  t.datetime "created_at", :null => false
27
34
  t.datetime "updated_at", :null => false
28
35
  end
29
36
 
30
- create_table "fail_ones", :force => true do |t|
37
+ create_table "boolean_defaults", :force => true do |t|
31
38
  t.string "name"
32
39
  t.boolean "default"
33
40
  t.datetime "created_at", :null => false
34
41
  t.datetime "updated_at", :null => false
35
42
  end
36
43
 
37
- create_table "posts", :force => true do |t|
44
+ create_table "fail_ones", :force => true do |t|
38
45
  t.string "name"
39
- t.integer "user_id"
46
+ t.boolean "default"
40
47
  t.datetime "created_at", :null => false
41
48
  t.datetime "updated_at", :null => false
42
49
  end
@@ -56,17 +63,11 @@ ActiveRecord::Schema.define(:version => 20120105110842) do
56
63
  end
57
64
 
58
65
  create_table "users", :force => true do |t|
59
- t.string "role"
60
66
  t.string "name"
61
- t.datetime "created_at", :null => false
62
- t.datetime "updated_at", :null => false
63
- end
64
-
65
- create_table "without_cancans", :force => true do |t|
66
- t.string "name"
67
- t.integer "position"
68
- t.datetime "created_at", :null => false
69
- t.datetime "updated_at", :null => false
67
+ t.boolean "default"
68
+ t.integer "default_blog_post"
69
+ t.datetime "created_at", :null => false
70
+ t.datetime "updated_at", :null => false
70
71
  end
71
72
 
72
73
  end
@@ -0,0 +1,9 @@
1
+ FactoryGirl.define do
2
+ factory :admin do
3
+ name 'bill'
4
+ end
5
+
6
+ factory :admin2, class: Admin do
7
+ name 'chief'
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ FactoryGirl.define do
2
+ factory :blogPost do
3
+ text 'hello'
4
+ end
5
+
6
+ factory :blogPost2, class: BlogPost do
7
+ text 'world'
8
+ end
9
+ end
10
+
@@ -0,0 +1,10 @@
1
+ FactoryGirl.define do
2
+ factory :user do
3
+ name 'bill'
4
+ end
5
+
6
+ factory :user2, class: User do
7
+ name 'chief'
8
+ end
9
+ end
10
+
@@ -0,0 +1,79 @@
1
+ require 'spec_helper'
2
+
3
+ describe Admin do
4
+
5
+ let(:admin1) { FactoryGirl.create(:admin) }
6
+ let(:admin2) { FactoryGirl.create(:admin2) }
7
+ let(:post1) { FactoryGirl.create(:blogPost) }
8
+ let(:post2) { FactoryGirl.build(:blogPost2) }
9
+ let(:other) { FactoryGirl.create(:other) }
10
+
11
+ it 'should have a default relation column definition' do
12
+ Admin.respond_to?('default_relation_column').should be true
13
+ end
14
+
15
+ it 'should return the argument as the default relation column' do
16
+ Admin.default_relation_column.should be_eql('main_blog_post')
17
+ end
18
+
19
+ it 'should have an attribute named main_blog_post' do
20
+ admin1.has_attribute?('main_blog_post').should be true
21
+ end
22
+
23
+ it 'should return nil if there is no default relation object' do
24
+ admin1.main_blog_post.should be_nil
25
+ end
26
+
27
+ it 'should return the default relation object' do
28
+ admin1.main_blog_post = post1
29
+ admin1.save
30
+ admin1.main_blog_post.should be_eql(post1)
31
+ end
32
+
33
+ it 'should return nil if relation object is deleted' do
34
+ admin1.main_blog_post = post1
35
+ admin1.save
36
+ post1.destroy
37
+ admin1.reload
38
+ admin1.main_blog_post.should be_nil
39
+ end
40
+
41
+ it "should return nil if relation object is deleted and another one take it's place" do
42
+ admin1.main_blog_post = post1
43
+ admin1.save
44
+ id = post1.id
45
+ post1.destroy
46
+
47
+ post2.id = id
48
+ post2.save
49
+ admin1.reload
50
+ admin1.reload.main_blog_post.should be_nil
51
+ end
52
+
53
+ it 'both users should return nil if relation object is deleted' do
54
+ admin1.main_blog_post = post1
55
+ admin2.main_blog_post = post1
56
+
57
+ id = post1.id
58
+ post1.destroy
59
+ post2.id = id
60
+ post2.save
61
+ admin1.reload
62
+ admin2.reload
63
+
64
+ admin1.main_blog_post.should be_nil
65
+ admin2.main_blog_post.should be_nil
66
+ end
67
+
68
+ it 'should return nil if relation object is not saved' do
69
+ admin1.main_blog_post = post2
70
+ admin1.main_blog_post.should be_nil
71
+ end
72
+
73
+ it 'should return nil if wrong relation object class is saved' do
74
+ admin1.main_blog_post = other
75
+ admin1.main_blog_post.should be_nil
76
+ end
77
+
78
+ end
79
+
@@ -6,11 +6,11 @@ describe Another do
6
6
  let(:other) { FactoryGirl.build(:other) }
7
7
 
8
8
  it 'should have a class method named default' do
9
- Another.respond_to?('default').should be_true
9
+ Another.respond_to?('default').should be true
10
10
  end
11
11
 
12
12
  it 'should have a default column definition' do
13
- Another.respond_to?('default_column').should be_true
13
+ Another.respond_to?('default_column').should be true
14
14
  end
15
15
 
16
16
  it 'should return the argument as the default column' do
@@ -6,11 +6,11 @@ describe BooleanDefault do
6
6
  let(:two) { FactoryGirl.build(:true_boolean_default) }
7
7
 
8
8
  it 'should have a class method named default' do
9
- BooleanDefault.respond_to?('default').should be_true
9
+ BooleanDefault.respond_to?('default').should be true
10
10
  end
11
11
 
12
12
  it 'should have a default column definition' do
13
- BooleanDefault.respond_to?('default_column').should be_true
13
+ BooleanDefault.respond_to?('default_column').should be true
14
14
  end
15
15
 
16
16
  it 'should return the argument as the default column' do
@@ -6,11 +6,11 @@ describe StringDefault do
6
6
  let(:two) { FactoryGirl.build(:true_string_default) }
7
7
 
8
8
  it 'should have a class method named default' do
9
- StringDefault.respond_to?('default').should be_true
9
+ StringDefault.respond_to?('default').should be true
10
10
  end
11
11
 
12
12
  it 'should have a default column definition' do
13
- StringDefault.respond_to?('default_column').should be_true
13
+ StringDefault.respond_to?('default_column').should be true
14
14
  end
15
15
 
16
16
  it 'should return the argument as the default column' do
@@ -6,11 +6,11 @@ describe TestDefault do
6
6
  let(:two) { FactoryGirl.build(:td_two) }
7
7
 
8
8
  it 'should have a class method named default' do
9
- TestDefault.respond_to?('default').should be_true
9
+ TestDefault.respond_to?('default').should be true
10
10
  end
11
11
 
12
12
  it 'should have a default column definition' do
13
- TestDefault.respond_to?('default_column').should be_true
13
+ TestDefault.respond_to?('default_column').should be true
14
14
  end
15
15
 
16
16
  it 'should return the argument as the default column' do
@@ -0,0 +1,78 @@
1
+ require 'spec_helper'
2
+
3
+ describe User do
4
+
5
+ let(:user1) { FactoryGirl.create(:user) }
6
+ let(:user2) { FactoryGirl.create(:user2) }
7
+ let(:post1) { FactoryGirl.create(:blogPost) }
8
+ let(:post2) { FactoryGirl.build(:blogPost2) }
9
+ let(:other) { FactoryGirl.create(:other) }
10
+
11
+ it 'should have a default relation column definition' do
12
+ User.respond_to?('default_relation_column').should be true
13
+ end
14
+
15
+ it 'should return the argument as the default relation column' do
16
+ User.default_relation_column.should be_eql('default_blog_post')
17
+ end
18
+
19
+ it 'should have an attribute named default_blog_post' do
20
+ user1.has_attribute?('default_blog_post').should be true
21
+ end
22
+
23
+ it 'should return nil if there is no default relation object' do
24
+ user1.default_blog_post.should be_nil
25
+ end
26
+
27
+ it 'should return the default relation object' do
28
+ user1.default_blog_post = post1
29
+ user1.save
30
+ user1.default_blog_post.should be_eql(post1)
31
+ end
32
+
33
+ it 'should return nil if relation object is deleted' do
34
+ user1.default_blog_post = post1
35
+ user1.save
36
+ post1.destroy
37
+ user1.reload
38
+ user1.default_blog_post.should be_nil
39
+ end
40
+
41
+ it "should return nil if relation object is deleted and another one take it's place" do
42
+ user1.default_blog_post = post1
43
+ user1.save
44
+ id = post1.id
45
+ post1.destroy
46
+
47
+ post2.id = id
48
+ post2.save
49
+ user1.reload
50
+ user1.reload.default_blog_post.should be_nil
51
+ end
52
+
53
+ it 'both users should return nil if relation object is deleted' do
54
+ user1.default_blog_post = post1
55
+ user2.default_blog_post = post1
56
+
57
+ id = post1.id
58
+ post1.destroy
59
+ post2.id = id
60
+ post2.save
61
+ user1.reload
62
+ user2.reload
63
+ user1.default_blog_post.should be_nil
64
+ user2.default_blog_post.should be_nil
65
+ end
66
+
67
+ it 'should return nil if relation object is not saved' do
68
+ user1.default_blog_post = post2
69
+ user1.default_blog_post.should be_nil
70
+ end
71
+
72
+ it 'should return nil if wrong relation object class is saved' do
73
+ user1.default_blog_post = other
74
+ user1.default_blog_post.should be_nil
75
+ end
76
+
77
+ end
78
+
@@ -11,7 +11,6 @@ Spork.prefork do
11
11
  require File.expand_path("../dummy/config/environment", __FILE__)
12
12
 
13
13
  require 'rspec/rails'
14
- require 'rspec/autorun'
15
14
 
16
15
  # Requires supporting ruby files with custom matchers and macros, etc,
17
16
  # in spec/support/ and its subdirectories.
@@ -72,6 +71,7 @@ Spork.prefork do
72
71
 
73
72
  # Include factory_girl's helpers
74
73
  #config.include FactoryGirl::Syntax::Methods
74
+ config.expect_with(:rspec) { |c| c.syntax = :should }
75
75
  end
76
76
  end
77
77
 
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_defaultable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giorgos Tsiftsis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-02 00:00:00.000000000 Z
11
+ date: 2015-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 3.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 3.0.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: mysql2
42
+ name: sqlite3
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
@@ -70,84 +70,84 @@ dependencies:
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec-rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: factory_girl_rails
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: spork
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ! '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ! '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: database_cleaner
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ! '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ! '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: guard-rspec
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ! '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ! '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  description: This 'acts_as' extension provides the capability for having a default
@@ -159,9 +159,9 @@ executables: []
159
159
  extensions: []
160
160
  extra_rdoc_files: []
161
161
  files:
162
- - .gitignore
163
- - .rspec
164
- - .travis.yml
162
+ - ".gitignore"
163
+ - ".rspec"
164
+ - ".travis.yml"
165
165
  - Gemfile
166
166
  - Guardfile
167
167
  - README.md
@@ -178,11 +178,14 @@ files:
178
178
  - spec/dummy/app/helpers/application_helper.rb
179
179
  - spec/dummy/app/mailers/.gitkeep
180
180
  - spec/dummy/app/models/.gitkeep
181
+ - spec/dummy/app/models/admin.rb
181
182
  - spec/dummy/app/models/another.rb
183
+ - spec/dummy/app/models/blog_post.rb
182
184
  - spec/dummy/app/models/boolean_default.rb
183
185
  - spec/dummy/app/models/fail_one.rb
184
186
  - spec/dummy/app/models/string_default.rb
185
187
  - spec/dummy/app/models/test_default.rb
188
+ - spec/dummy/app/models/user.rb
186
189
  - spec/dummy/app/views/layouts/application.html.erb
187
190
  - spec/dummy/config.ru
188
191
  - spec/dummy/config/application.rb
@@ -205,6 +208,9 @@ files:
205
208
  - spec/dummy/db/migrate/20120104135210_create_boolean_defaults.rb
206
209
  - spec/dummy/db/migrate/20120104140205_create_string_defaults.rb
207
210
  - spec/dummy/db/migrate/20120104234100_create_test_defaults.rb
211
+ - spec/dummy/db/migrate/20150522153654_create_users.rb
212
+ - spec/dummy/db/migrate/20150522155643_create_blog_posts.rb
213
+ - spec/dummy/db/migrate/20150522160050_create_admins.rb
208
214
  - spec/dummy/db/schema.rb
209
215
  - spec/dummy/lib/assets/.gitkeep
210
216
  - spec/dummy/log/.gitkeep
@@ -213,16 +219,21 @@ files:
213
219
  - spec/dummy/public/500.html
214
220
  - spec/dummy/public/favicon.ico
215
221
  - spec/dummy/script/rails
222
+ - spec/factories/admin.rb
216
223
  - spec/factories/another.rb
224
+ - spec/factories/blog_post.rb
217
225
  - spec/factories/boolean_default.rb
218
226
  - spec/factories/fail_one.rb
219
227
  - spec/factories/string_default.rb
220
228
  - spec/factories/test_default.rb
229
+ - spec/factories/user.rb
230
+ - spec/models/admin_spec.rb
221
231
  - spec/models/another_spec.rb
222
232
  - spec/models/boolean_default_spec.rb
223
233
  - spec/models/fail_one_spec.rb
224
234
  - spec/models/string_default_spec.rb
225
235
  - spec/models/test_default_spec.rb
236
+ - spec/models/user_spec.rb
226
237
  - spec/spec_helper.rb
227
238
  homepage: https://github.com/chief/acts_as_defaultable
228
239
  licenses: []
@@ -233,17 +244,17 @@ require_paths:
233
244
  - lib
234
245
  required_ruby_version: !ruby/object:Gem::Requirement
235
246
  requirements:
236
- - - ! '>='
247
+ - - ">="
237
248
  - !ruby/object:Gem::Version
238
249
  version: '0'
239
250
  required_rubygems_version: !ruby/object:Gem::Requirement
240
251
  requirements:
241
- - - ! '>='
252
+ - - ">="
242
253
  - !ruby/object:Gem::Version
243
254
  version: '0'
244
255
  requirements: []
245
256
  rubyforge_project:
246
- rubygems_version: 2.1.11
257
+ rubygems_version: 2.4.6
247
258
  signing_key:
248
259
  specification_version: 4
249
260
  summary: A gem allowing an active_record model to be default(unique) based on a specified