alchemy_crm 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +10 -11
- data/alchemy_crm.gemspec +21 -21
- data/app/assets/javascripts/alchemy_crm/alchemy_crm.base.js +54 -54
- data/app/assets/stylesheets/alchemy_crm/base.css.scss +199 -199
- data/app/controllers/alchemy_crm/admin/base_controller.rb +5 -5
- data/app/controllers/alchemy_crm/admin/contact_groups_controller.rb +15 -15
- data/app/controllers/alchemy_crm/admin/contacts_controller.rb +95 -95
- data/app/controllers/alchemy_crm/admin/deliveries_controller.rb +66 -66
- data/app/controllers/alchemy_crm/admin/elements_controller_extension.rb +23 -23
- data/app/controllers/alchemy_crm/admin/mailings_controller.rb +44 -44
- data/app/controllers/alchemy_crm/admin/newsletters_controller.rb +16 -16
- data/app/controllers/alchemy_crm/admin/tags_controller.rb +60 -59
- data/app/controllers/alchemy_crm/base_controller.rb +3 -3
- data/app/controllers/alchemy_crm/contacts_controller.rb +88 -88
- data/app/controllers/alchemy_crm/mailings_controller.rb +16 -16
- data/app/controllers/alchemy_crm/recipients_controller.rb +30 -30
- data/app/controllers/alchemy_crm/subscriptions_controller.rb +54 -54
- data/app/helpers/alchemy/pages_helper_extension.rb +14 -14
- data/app/helpers/alchemy_crm/admin/base_helper.rb +8 -8
- data/app/helpers/alchemy_crm/mailings_helper.rb +175 -175
- data/app/mailers/alchemy_crm/bounce_receiver.rb +9 -9
- data/app/mailers/alchemy_crm/contacts_mailer.rb +21 -21
- data/app/mailers/alchemy_crm/mailings_mailer.rb +46 -46
- data/app/mailers/alchemy_crm/subscriptions_mailer.rb +12 -12
- data/app/models/alchemy/essence_element_teaser.rb +14 -14
- data/app/models/alchemy_crm/contact.rb +260 -260
- data/app/models/alchemy_crm/contact_group.rb +15 -15
- data/app/models/alchemy_crm/contact_group_filter.rb +17 -17
- data/app/models/alchemy_crm/delivery.rb +54 -54
- data/app/models/alchemy_crm/element_extension.rb +23 -23
- data/app/models/alchemy_crm/mailing.rb +90 -90
- data/app/models/alchemy_crm/newsletter.rb +33 -33
- data/app/models/alchemy_crm/reaction.rb +5 -5
- data/app/models/alchemy_crm/recipient.rb +46 -46
- data/app/models/alchemy_crm/subscription.rb +4 -4
- data/app/views/alchemy/admin/elements/fill.js.erb +11 -11
- data/app/views/alchemy/elements/_newsletter_article_view.html.erb +14 -14
- data/app/views/alchemy/elements/_newsletter_greeting_view.html.erb +9 -9
- data/app/views/alchemy/elements/_newsletter_signout_form_view.html.erb +18 -18
- data/app/views/alchemy/elements/_newsletter_signup_form_view.html.erb +62 -62
- data/app/views/alchemy/essences/_essence_element_teaser_editor.html.erb +29 -29
- data/app/views/alchemy/newsletter_layouts/_standard.html.erb +37 -37
- data/app/views/alchemy_crm/admin/contact_groups/_contact_group.html.erb +30 -30
- data/app/views/alchemy_crm/admin/contact_groups/_filter.html.erb +28 -28
- data/app/views/alchemy_crm/admin/contact_groups/_form.html.erb +45 -45
- data/app/views/alchemy_crm/admin/contact_groups/_tag.html.erb +4 -4
- data/app/views/alchemy_crm/admin/contact_groups/add_filter.js.erb +7 -7
- data/app/views/alchemy_crm/admin/contact_groups/index.html.erb +28 -28
- data/app/views/alchemy_crm/admin/contacts/_contact.html.erb +42 -42
- data/app/views/alchemy_crm/admin/contacts/_form.html.erb +76 -76
- data/app/views/alchemy_crm/admin/contacts/import.html.erb +27 -27
- data/app/views/alchemy_crm/admin/contacts/index.html.erb +39 -39
- data/app/views/alchemy_crm/admin/contacts/vcf_import_result.html.erb +24 -24
- data/app/views/alchemy_crm/admin/deliveries/_delivery.html.erb +30 -30
- data/app/views/alchemy_crm/admin/deliveries/_form.html.erb +61 -61
- data/app/views/alchemy_crm/admin/deliveries/_recipient.html.erb +36 -36
- data/app/views/alchemy_crm/admin/deliveries/index.html.erb +21 -21
- data/app/views/alchemy_crm/admin/deliveries/show.html.erb +61 -61
- data/app/views/alchemy_crm/admin/elements/teasables.html.erb +53 -53
- data/app/views/alchemy_crm/admin/mailings/_form.html.erb +41 -41
- data/app/views/alchemy_crm/admin/mailings/_mailing.html.erb +73 -73
- data/app/views/alchemy_crm/admin/mailings/edit_content.html.erb +170 -170
- data/app/views/alchemy_crm/admin/mailings/import_result.html.erb +18 -18
- data/app/views/alchemy_crm/admin/mailings/index.html.erb +25 -25
- data/app/views/alchemy_crm/admin/newsletters/_form.html.erb +52 -52
- data/app/views/alchemy_crm/admin/newsletters/_tag_with_radiobutton.html.erb +5 -5
- data/app/views/alchemy_crm/admin/newsletters/index.html.erb +29 -29
- data/app/views/alchemy_crm/admin/newsletters/new.html.erb +4 -4
- data/app/views/alchemy_crm/admin/tags/_radio_tag.html.erb +4 -4
- data/app/views/alchemy_crm/admin/tags/_tag.html.erb +30 -30
- data/app/views/alchemy_crm/admin/tags/edit.html.erb +32 -32
- data/app/views/alchemy_crm/admin/tags/index.html.erb +23 -23
- data/app/views/alchemy_crm/admin/tags/new.html.erb +14 -14
- data/app/views/alchemy_crm/contacts_mailer/signout_mail.html.erb +6 -6
- data/app/views/alchemy_crm/contacts_mailer/signout_mail.text.erb +2 -2
- data/app/views/alchemy_crm/contacts_mailer/signup_mail.html.erb +9 -9
- data/app/views/alchemy_crm/contacts_mailer/signup_mail.text.erb +2 -2
- data/app/views/alchemy_crm/mailings_mailer/verification_mail.html.erb +9 -9
- data/app/views/alchemy_crm/subscriptions/index.html.erb +4 -4
- data/app/views/alchemy_crm/subscriptions_mailer/overview_mail.html.erb +25 -25
- data/app/views/alchemy_crm/subscriptions_mailer/overview_mail.text.erb +2 -2
- data/app/views/csv_magic/import_errors.html.erb +23 -23
- data/app/views/csv_magic/mapper.html.erb +46 -46
- data/app/views/layouts/alchemy_crm/mailings.html.erb +177 -177
- data/config/initializers/assets.rb +2 -2
- data/config/locales/alchemy_crm.de.yml +1 -1
- data/config/locales/alchemy_crm.en.yml +1 -0
- data/config/locales/localized_country_select.de.rb +260 -260
- data/config/locales/localized_country_select.en.rb +274 -274
- data/config/routes.rb +67 -67
- data/db/migrate/20111104125306_remove_sent_mailing_pdf_id_from_sent_mailings.rb +1 -1
- data/db/migrate/20111124145923_namespace_alchemy_crm_models.rb +13 -13
- data/db/migrate/20120307160721_rename_alchemy_crm_recipients_sent_mailing_id.rb +3 -3
- data/db/migrate/20120320103412_add_indexes_to_alchemy_crm_sha1_columns.rb +3 -3
- data/db/migrate/20120327174301_add_more_indexes_to_alchemy_crm_tables.rb +10 -10
- data/lib/alchemy_crm.rb +15 -15
- data/lib/alchemy_crm/bounced_delivery.rb +38 -38
- data/lib/alchemy_crm/config.rb +25 -25
- data/lib/alchemy_crm/engine.rb +31 -31
- data/lib/alchemy_crm/i18n_helpers.rb +28 -28
- data/lib/alchemy_crm/newsletter_layout.rb +28 -28
- data/lib/alchemy_crm/seeder.rb +26 -26
- data/lib/alchemy_crm/version.rb +1 -1
- data/lib/generators/alchemy_crm/scaffold/files/newsletters.html.erb +19 -19
- data/lib/generators/alchemy_crm/scaffold/scaffold_generator.rb +2 -2
- data/lib/tasks/alchemy_crm.rake +22 -22
- data/lib/tasks/routes.rake +25 -25
- data/spec/config_spec.rb +24 -24
- data/spec/controllers/alchemy_crm/contacts_controller_spec.rb +147 -147
- data/spec/controllers/alchemy_crm/mailings_controller_spec.rb +62 -62
- data/spec/controllers/alchemy_crm/recipients_controller_spec.rb +109 -109
- data/spec/helpers/alchemy_crm/mailings_helper_spec.rb +165 -165
- data/spec/mailers/alchemy_crm/contacts_mailer_spec.rb +84 -84
- data/spec/mailers/alchemy_crm/mailings_mailer_spec.rb +29 -29
- data/spec/models/alchemy_crm/contact_group_spec.rb +25 -25
- data/spec/models/alchemy_crm/contact_spec.rb +71 -71
- data/spec/models/alchemy_crm/delivery_spec.rb +43 -39
- data/spec/models/alchemy_crm/mailing_spec.rb +46 -42
- data/spec/models/alchemy_crm/newsletter_spec.rb +29 -29
- data/spec/spec_helper.rb +36 -36
- metadata +6 -8
- data/rails/init.rb +0 -1
- data/recipes/alchemy-mailings-capistrano-tasks.rb +0 -12
@@ -1,88 +1,88 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module AlchemyCrm
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
4
|
+
describe ContactsMailer do
|
5
|
+
|
6
|
+
include AlchemyCrm::Engine.routes.url_helpers
|
7
|
+
|
8
|
+
before(:all) do
|
9
|
+
Alchemy::PageLayout.add({"name" => 'newsletter_mails', "elements" => ['newsletter_signup_mail'], "autogenerate" => ["newsletter_signup_mail"]})
|
10
|
+
@language_root = Alchemy::Page.create!(:name => 'Language Root', :page_layout => 'standard', :parent_id => Alchemy::Page.root.id, :language => Alchemy::Language.get_default)
|
11
|
+
@page = Alchemy::Page.create!(:name => 'Newsletter Mails', :page_layout => 'newsletter_mails', :parent_id => @language_root.id, :language => @language_root.language)
|
12
|
+
@contact = Contact.create!(:email => 'jon@doe.com', :firstname => 'Jon', :lastname => 'Doe', :salutation => 'mr')
|
13
|
+
@newsletter = Newsletter.create!(:name => 'Newsletter', :layout => 'standard')
|
14
|
+
@subscription = Subscription.create!(:contact => @contact, :newsletter => @newsletter, :verified => true, :wants => true)
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#signup_mail' do
|
18
|
+
|
19
|
+
before(:all) do
|
20
|
+
@element = @page.elements.find_by_name(:newsletter_signup_mail)
|
21
|
+
@element.content_by_name('mail_from').essence.update_attribute(:body, 'frank@dank.com')
|
22
|
+
@element.content_by_name('subject').essence.update_attribute(:body, 'Welcome, please confirm')
|
23
|
+
@element.content_by_name('text').essence.update_attribute(:body, 'Hello %{name}, please click %{link}')
|
24
|
+
@email = ContactsMailer.signup_mail(@contact, @page).deliver
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should deliver to the contact's email address" do
|
28
|
+
@email.should deliver_to(@contact.email)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should have correct delivered from" do
|
32
|
+
@email.should deliver_from(@element.ingredient('mail_from'))
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should contain a link to the confirmation link" do
|
36
|
+
url_regexp = Regexp.new(Regexp.escape(verify_contact_url(:token => @contact.email_sha1, :host => ActionMailer::Base.default_url_options[:host], :newsletter_ids => @contact.subscriptions.collect(&:newsletter_id))))
|
37
|
+
@email.should have_body_text(url_regexp)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should contain the correct greeting" do
|
41
|
+
@email.should have_body_text(/#{@contact.fullname}/)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should have the correct subject" do
|
45
|
+
@email.should have_subject(@element.ingredient('subject'))
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#signout_mail' do
|
51
|
+
|
52
|
+
before(:all) do
|
53
|
+
@element = @page.elements.find_by_name(:newsletter_signout_mail)
|
54
|
+
@element.content_by_name('mail_from').essence.update_attribute(:body, 'frank@dank.com')
|
55
|
+
@element.content_by_name('subject').essence.update_attribute(:body, 'Byebye, please confirm')
|
56
|
+
@element.content_by_name('text').essence.update_attribute(:body, 'Hello %{name}, please click %{link}')
|
57
|
+
@email = ContactsMailer.signout_mail(@contact, @page).deliver
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should deliver to the contact's email address" do
|
61
|
+
@email.should deliver_to(@contact.email)
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should have correct delivered from" do
|
65
|
+
@email.should deliver_from(@element.ingredient('mail_from'))
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should contain a link to the confirmation link" do
|
69
|
+
@email.should have_body_text(/#{disable_contact_url(:token => @contact.email_sha1, :host => ActionMailer::Base.default_url_options[:host])}/)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should contain the correct greeting" do
|
73
|
+
@email.should have_body_text(/#{@contact.fullname}/)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should have the correct subject" do
|
77
|
+
@email.should have_subject(@element.ingredient('subject'))
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
after(:all) do
|
83
|
+
@language_root.destroy
|
84
|
+
@contact.destroy
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
88
|
end
|
@@ -1,42 +1,42 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module AlchemyCrm
|
4
|
-
|
4
|
+
describe MailingsMailer do
|
5
5
|
|
6
|
-
|
6
|
+
describe '#build' do
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
before(:all) do
|
9
|
+
@mailing = Mailing.create!(:name => 'Mailing', :subject => 'News Mailing', :additional_email_addresses => "jim@family.com, jon@doe.com, jane@family.com, \n", :newsletter => Newsletter.create!(:name => 'Newsletter', :layout => 'newsletter_layout_standard'))
|
10
|
+
@mailing.deliveries.create!
|
11
|
+
@element = @mailing.page.elements.first
|
12
|
+
@element.content_by_name('text').essence.update_attribute(:body, "<h2>Hello World</h2>")
|
13
|
+
@recipient = @mailing.recipients.first
|
14
|
+
@language_root = Alchemy::Page.create!(:name => 'Language Root', :page_layout => 'standard', :language => Alchemy::Language.get_default, :parent_id => Alchemy::Page.root.id)
|
15
|
+
@unsubscribe_page = Alchemy::Page.create!(:name => 'Unsubscribe Page', :page_layout => 'newsletter_signout', :parent_id => @language_root.id, :language => Alchemy::Language.get_default)
|
16
|
+
@email = MailingsMailer.build(@mailing, @recipient, {:host => ActionMailer::Base.default_url_options[:host], :language_id => Alchemy::Language.get_default.id}).deliver
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
it "should render the mailings body." do
|
20
|
+
@email.should have_body_text(/#{Regexp.escape(@element.ingredient('text'))}/)
|
21
|
+
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
it "should render a plain text version of mailings body." do
|
24
|
+
@email.text_part.should_not have_body_text(/<h2>/)
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
it "should deliver to recipient's email." do
|
28
|
+
@email.should deliver_to(@recipient.email)
|
29
|
+
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
it "should have mailing's subject." do
|
32
|
+
@email.should have_subject(@mailing.subject)
|
33
|
+
end
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
after(:all) do
|
36
|
+
@language_root.destroy
|
37
|
+
end
|
38
38
|
|
39
|
-
|
39
|
+
end
|
40
40
|
|
41
|
-
|
41
|
+
end
|
42
42
|
end
|
@@ -1,41 +1,41 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module AlchemyCrm
|
4
|
-
|
4
|
+
describe ContactGroup do
|
5
5
|
|
6
|
-
|
6
|
+
describe "#contacts" do
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
before(:each) do
|
9
|
+
@verified_contact = Contact.create!({:email => 'jon@doe.com', :firstname => 'Jon', :lastname => 'Doe', :salutation => 'mr', :tag_list => 'father', :verified => true}, :as => :admin)
|
10
|
+
@contact = Contact.create!({:email => 'jane@smith.com', :firstname => 'Jane', :lastname => 'Smith', :salutation => 'ms', :tag_list => 'mother'}, :as => :admin)
|
11
|
+
@contact_group = ContactGroup.create!(:name => 'Family', :contact_tag_list => 'father, mother, son')
|
12
|
+
end
|
13
13
|
|
14
|
-
|
14
|
+
context "with filter" do
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
before(:each) do
|
17
|
+
@contact_group.filters.create!(:column => 'lastname', :operator => 'IS', :value => 'Doe', :contact_group => @contact_group)
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
it "should return correct list of contacts" do
|
21
|
+
@contact_group.contacts.collect(&:email).should == ["jon@doe.com"]
|
22
|
+
end
|
23
23
|
|
24
|
-
|
24
|
+
end
|
25
25
|
|
26
|
-
|
26
|
+
context "without filter" do
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
before(:each) do
|
29
|
+
@contact_group.filters.delete_all
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
it "should return all contacts with tag" do
|
33
|
+
@contact_group.contacts.collect(&:email).should == ["jon@doe.com", "jane@smith.com"]
|
34
|
+
end
|
35
35
|
|
36
|
-
|
36
|
+
end
|
37
37
|
|
38
|
-
|
38
|
+
end
|
39
39
|
|
40
|
-
|
40
|
+
end
|
41
41
|
end
|
@@ -1,108 +1,108 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module AlchemyCrm
|
4
|
-
|
4
|
+
describe Contact do
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
before(:all) do
|
7
|
+
@contact = Contact.create!({:email => 'jon@doe.com', :title => 'Dr.', :firstname => 'Jon', :lastname => 'Doe', :salutation => 'mr', :verified => true}, :as => :admin)
|
8
|
+
end
|
9
9
|
|
10
|
-
|
10
|
+
describe '.create' do
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
it "should set email_salt and email_sha1 for new records" do
|
13
|
+
@contact.email_sha1.should_not be_nil
|
14
|
+
@contact.email_salt.should_not be_nil
|
15
|
+
end
|
16
16
|
|
17
|
-
|
17
|
+
end
|
18
18
|
|
19
|
-
|
19
|
+
describe '#save' do
|
20
20
|
|
21
|
-
|
21
|
+
context "a contact with new email address" do
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
before(:each) do
|
24
|
+
@sha1 = @contact.email_sha1
|
25
|
+
@salt = @contact.email_salt
|
26
|
+
@contact.update_attributes!(:email => 'jane@doe.com')
|
27
|
+
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
it "should update email_sha1" do
|
30
|
+
@contact.email_sha1.should_not == @sha1
|
31
|
+
end
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
it "should not update salt" do
|
34
|
+
@contact.email_salt.should == @salt
|
35
|
+
end
|
36
36
|
|
37
|
-
|
37
|
+
end
|
38
38
|
|
39
|
-
|
39
|
+
context "a contact with same email address" do
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
before(:each) do
|
42
|
+
@sha1 = @contact.email_sha1
|
43
|
+
@salt = @contact.email_salt
|
44
|
+
@contact.update_attributes!(:firstname => 'jane')
|
45
|
+
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
it "should not update email_sha1" do
|
48
|
+
@contact.email_sha1.should == @sha1
|
49
|
+
end
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
it "should not update salt" do
|
52
|
+
@contact.email_salt.should == @salt
|
53
|
+
end
|
54
54
|
|
55
|
-
|
55
|
+
end
|
56
56
|
|
57
|
-
|
57
|
+
end
|
58
58
|
|
59
|
-
|
59
|
+
describe '#interpolation_name_value' do
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
before(:each) do
|
62
|
+
@contact.update_attributes!(:firstname => 'Jon')
|
63
|
+
end
|
64
64
|
|
65
|
-
|
65
|
+
context "not given a name_with_title value in the config" do
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
before(:each) do
|
68
|
+
Config.stub!(:get).and_return(nil)
|
69
|
+
end
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
it "should return the default value." do
|
72
|
+
@contact.interpolation_name_value.should == "Mr Dr. Jon Doe"
|
73
|
+
end
|
74
74
|
|
75
|
-
|
75
|
+
end
|
76
76
|
|
77
|
-
|
77
|
+
context "given a valid method name in the config" do
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
before(:each) do
|
80
|
+
Config.stub!(:get).and_return('name_with_title')
|
81
|
+
end
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
it "should return the correct value." do
|
84
|
+
@contact.interpolation_name_value.should == "Dr. Jon Doe"
|
85
|
+
end
|
86
86
|
|
87
|
-
|
87
|
+
end
|
88
88
|
|
89
|
-
|
89
|
+
context "given not a valid method name in the config" do
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
before(:each) do
|
92
|
+
Config.stub!(:get).and_return('password')
|
93
|
+
end
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
95
|
+
it "should return the default value." do
|
96
|
+
@contact.interpolation_name_value.should == "Mr Dr. Jon Doe"
|
97
|
+
end
|
98
98
|
|
99
|
-
|
99
|
+
end
|
100
100
|
|
101
|
-
|
101
|
+
end
|
102
102
|
|
103
|
-
|
104
|
-
|
105
|
-
|
103
|
+
after(:all) do
|
104
|
+
@contact.destroy
|
105
|
+
end
|
106
106
|
|
107
|
-
|
107
|
+
end
|
108
108
|
end
|