has_many_emails 0.2.11 → 0.2.16
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/has_many_emails.gemspec +2 -2
- data/lib/generators/templates/create_email_address.rb +1 -3
- data/lib/has_many_emails/class_methods.rb +1 -1
- data/{app/models → lib/has_many_emails}/email_address.rb +1 -1
- data/lib/has_many_emails/instance_methods.rb +1 -1
- data/lib/has_many_emails.rb +2 -1
- data/spec/models/email_spec.rb +2 -0
- data/spec/models/user_spec.rb +4 -0
- data/spec/spec_helper.rb +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.16
|
data/has_many_emails.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{has_many_emails}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.16"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Danil Pismenny"]
|
@@ -21,7 +21,6 @@ Gem::Specification.new do |s|
|
|
21
21
|
"README.rdoc",
|
22
22
|
"Rakefile",
|
23
23
|
"VERSION",
|
24
|
-
"app/models/email_address.rb",
|
25
24
|
"has_many_emails.gemspec",
|
26
25
|
"init.rb",
|
27
26
|
"install.rb",
|
@@ -30,6 +29,7 @@ Gem::Specification.new do |s|
|
|
30
29
|
"lib/generators/templates/create_email_address.rb",
|
31
30
|
"lib/has_many_emails.rb",
|
32
31
|
"lib/has_many_emails/class_methods.rb",
|
32
|
+
"lib/has_many_emails/email_address.rb",
|
33
33
|
"lib/has_many_emails/instance_methods.rb",
|
34
34
|
"spec/db/create_db.rb",
|
35
35
|
"spec/db/database.yml",
|
@@ -4,7 +4,7 @@ class <%= migration_name %> < ActiveRecord::Migration
|
|
4
4
|
create_table :<%= email_address_table_name %> do |t|
|
5
5
|
t.integer :user_id, :null => false
|
6
6
|
t.string :email, :null => false
|
7
|
-
t.boolean :is_main, :null => false, :default=>false
|
7
|
+
# t.boolean :is_main, :null => false, :default=>false
|
8
8
|
|
9
9
|
t.timestamps
|
10
10
|
end
|
@@ -25,9 +25,7 @@ class <%= migration_name %> < ActiveRecord::Migration
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.down
|
28
|
-
|
29
28
|
drop_table :<%= email_address_table_name %>
|
30
|
-
|
31
29
|
end
|
32
30
|
|
33
31
|
end
|
data/lib/has_many_emails.rb
CHANGED
@@ -4,6 +4,7 @@ require 'validate_email'
|
|
4
4
|
|
5
5
|
require 'has_many_emails/class_methods'
|
6
6
|
require 'has_many_emails/instance_methods'
|
7
|
+
require 'has_many_emails/email_address'
|
7
8
|
|
8
9
|
module HasManyEmails
|
9
10
|
|
@@ -12,7 +13,7 @@ module HasManyEmails
|
|
12
13
|
def has_many_emails
|
13
14
|
class_eval <<-EOV
|
14
15
|
|
15
|
-
has_many :email_addresses, :dependent=>:destroy
|
16
|
+
has_many :email_addresses, :dependent=>:destroy, :class_name => 'HasManyEmails::EmailAddress'
|
16
17
|
|
17
18
|
validate :validate_email_addresses
|
18
19
|
|
data/spec/models/email_spec.rb
CHANGED
data/spec/models/user_spec.rb
CHANGED
@@ -106,6 +106,10 @@ describe User do
|
|
106
106
|
before(:all) { @user = User.create!(:email=>EMAIL) }
|
107
107
|
it_should_behave_like "valid and have an email"
|
108
108
|
|
109
|
+
specify do
|
110
|
+
User.find_by_email( EMAIL.upcase ).email.should == EMAIL
|
111
|
+
end
|
112
|
+
|
109
113
|
context "and unset email" do
|
110
114
|
before(:all) { @user.email = '' }
|
111
115
|
specify { @user.emails.should be_empty }
|
data/spec/spec_helper.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'active_record'
|
4
4
|
require 'remarkable/active_record'
|
5
5
|
|
6
|
-
require '
|
6
|
+
require 'init'
|
7
7
|
|
8
8
|
RSpec.configure do |config|
|
9
9
|
config.include AttributeNormalizer::RSpecMatcher # Models group type is missing at this time rspec-rails 2.0.0.beta.11
|
@@ -16,7 +16,7 @@ SPEC='./spec'
|
|
16
16
|
require 'db/create_db'
|
17
17
|
|
18
18
|
# Load the model
|
19
|
-
load "#{SPEC}/../app/models/email_address.rb"
|
19
|
+
# load "#{SPEC}/../app/models/has_many_emails/email_address.rb"
|
20
20
|
load "#{SPEC}/db/models/user.rb"
|
21
21
|
|
22
22
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_many_emails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 55
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 16
|
10
|
+
version: 0.2.16
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Danil Pismenny
|
@@ -102,7 +102,6 @@ files:
|
|
102
102
|
- README.rdoc
|
103
103
|
- Rakefile
|
104
104
|
- VERSION
|
105
|
-
- app/models/email_address.rb
|
106
105
|
- has_many_emails.gemspec
|
107
106
|
- init.rb
|
108
107
|
- install.rb
|
@@ -111,6 +110,7 @@ files:
|
|
111
110
|
- lib/generators/templates/create_email_address.rb
|
112
111
|
- lib/has_many_emails.rb
|
113
112
|
- lib/has_many_emails/class_methods.rb
|
113
|
+
- lib/has_many_emails/email_address.rb
|
114
114
|
- lib/has_many_emails/instance_methods.rb
|
115
115
|
- spec/db/create_db.rb
|
116
116
|
- spec/db/database.yml
|