mail_manager 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/.gitignore +5 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -1
- data/Gemfile +27 -10
- data/LICENSE.txt +2 -2
- data/MIT-LICENSE +1 -1
- data/README.md +97 -15
- data/{features/bounce_management.feature → app/assets/images/mail_manager/.gitkeep} +0 -0
- data/app/assets/images/mail_manager/BottomRight.gif +0 -0
- data/app/assets/images/mail_manager/MidRight.gif +0 -0
- data/app/assets/images/mail_manager/TopCenter.gif +0 -0
- data/app/assets/images/mail_manager/TopRight.gif +0 -0
- data/app/assets/images/mail_manager/calendar_date_select/calendar.gif +0 -0
- data/app/assets/images/mail_manager/iReach_logo.gif +0 -0
- data/app/assets/images/mail_manager/spacer.gif +0 -0
- data/app/assets/images/mail_manager/topMid.gif +0 -0
- data/app/assets/javascripts/mail_manager/application.js +19 -1
- data/app/assets/javascripts/mail_manager/jquery-ui-timepicker-addon.js +2134 -0
- data/app/assets/stylesheets/mail_manager/admin.css +261 -0
- data/app/assets/stylesheets/mail_manager/application.css +3 -1
- data/app/assets/stylesheets/mail_manager/nav.css +68 -0
- data/app/assets/stylesheets/mail_manager/timepicker.css +11 -0
- data/app/controllers/mail_manager/application_controller.rb +7 -2
- data/app/controllers/mail_manager/bounces_controller.rb +5 -10
- data/app/controllers/mail_manager/contacts_controller.rb +42 -20
- data/app/controllers/mail_manager/mailing_lists_controller.rb +5 -12
- data/app/controllers/mail_manager/mailings_controller.rb +18 -18
- data/app/controllers/mail_manager/messages_controller.rb +3 -10
- data/app/controllers/mail_manager/subscriptions_controller.rb +16 -75
- data/app/helpers/mail_manager/layout_helper.rb +43 -0
- data/app/models/mail_manager/bounce.rb +16 -5
- data/app/models/mail_manager/contact.rb +64 -1
- data/app/models/mail_manager/mailable.rb +14 -0
- data/app/models/mail_manager/mailer.rb +48 -81
- data/app/models/mail_manager/mailing.rb +23 -42
- data/app/models/mail_manager/message.rb +52 -8
- data/app/models/mail_manager/subscription.rb +9 -3
- data/app/models/status_history.rb +3 -2
- data/app/views/layouts/mail_manager/application.html.erb +33 -5
- data/app/views/layouts/mail_manager/layout.html.erb +15 -0
- data/app/views/mail_manager/bounces/index.html.erb +6 -4
- data/app/views/mail_manager/bounces/show.html.erb +3 -3
- data/app/views/mail_manager/contacts/_form.html.erb +7 -23
- data/app/views/mail_manager/contacts/edit.html.erb +3 -3
- data/app/views/mail_manager/contacts/index.html.erb +14 -28
- data/app/views/mail_manager/contacts/new.html.erb +2 -2
- data/app/views/mail_manager/contacts/show.html.erb +5 -5
- data/app/views/mail_manager/contacts/subscribe.html.erb +1 -1
- data/app/views/mail_manager/mailer/double_opt_in.erb +1 -1
- data/app/views/mail_manager/mailer/double_opt_in.html.erb +6 -0
- data/app/views/mail_manager/mailer/unsubscribed.erb +1 -1
- data/app/views/mail_manager/mailer/unsubscribed.html.erb +1 -1
- data/app/views/mail_manager/mailing_lists/_form.html.erb +8 -17
- data/app/views/mail_manager/mailing_lists/edit.html.erb +4 -4
- data/app/views/mail_manager/mailing_lists/index.html.erb +6 -5
- data/app/views/mail_manager/mailing_lists/new.html.erb +3 -3
- data/app/views/mail_manager/mailings/_form.html.erb +22 -44
- data/app/views/mail_manager/mailings/edit.html.erb +3 -3
- data/app/views/mail_manager/mailings/index.html.erb +23 -27
- data/app/views/mail_manager/mailings/new.html.erb +2 -2
- data/app/views/mail_manager/mailings/test.html.erb +3 -3
- data/app/views/mail_manager/messages/index.html.erb +2 -2
- data/app/views/mail_manager/subscriptions/_form.html.erb +1 -1
- data/app/views/mail_manager/subscriptions/_subscriptions.html.erb +2 -2
- data/app/views/mail_manager/subscriptions/edit.html.erb +2 -2
- data/app/views/mail_manager/subscriptions/index.html.erb +3 -3
- data/app/views/mail_manager/subscriptions/new.html.erb +1 -1
- data/app/views/mail_manager/subscriptions/unsubscribe.html.erb +1 -1
- data/app/views/mail_manager/subscriptions/unsubscribe_by_email_address.html.erb +3 -3
- data/config/locales/en.yml +13 -0
- data/config/locales/mailings.en.yml +52 -0
- data/config/routes.rb +21 -19
- data/db/migrate/008_add_bounces_count_to_mailings.rb +14 -0
- data/db/migrate/009_add_messages_count_to_mailings.rb +14 -0
- data/db/migrate/010_add_login_token_to_contact.rb +11 -0
- data/db/migrate/011_add_deleted_at_to_mailing.rb +11 -0
- data/lib/delayed/mailer.rb +9 -5
- data/lib/delayed/status.rb +6 -2
- data/lib/delayed_overrides/worker.rb +21 -0
- data/lib/deleteable.rb +13 -14
- data/lib/mail_manager/config.rb +3 -3
- data/lib/mail_manager/engine.rb +136 -7
- data/lib/mail_manager/lock.rb +1 -0
- data/lib/mail_manager/version.rb +1 -1
- data/lib/tasks/mail_manager.rake +92 -56
- data/mail_manager.gemspec +4 -0
- data/spec/rails_helper.rb +50 -0
- data/spec/spec_helper.rb +87 -48
- data/spec/test_app/.env.development +3 -0
- data/spec/test_app/.env.test +2 -0
- data/spec/test_app/.rspec +1 -0
- data/spec/test_app/Procfile +3 -0
- data/spec/test_app/app/controllers/application_controller.rb +4 -0
- data/spec/test_app/app/models/ability.rb +7 -0
- data/spec/test_app/app/models/user.rb +8 -2
- data/spec/test_app/app/models/user_with_role.rb +22 -0
- data/spec/test_app/config/database.postgres.yml +21 -0
- data/spec/test_app/config/database.sqlite.yml +2 -2
- data/spec/test_app/config/environment.rb +2 -2
- data/spec/test_app/config/environments/test.rb +13 -0
- data/spec/test_app/config/mail_manager.yml +66 -2
- data/spec/test_app/config/routes.rb +0 -1
- data/spec/test_app/db/migrate/20150420163235_add_bounces_count_to_mailings.rb +14 -0
- data/spec/test_app/db/migrate/20150420163804_add_messages_count_to_mailings.rb +14 -0
- data/spec/test_app/db/migrate/20150421151457_add_login_token_to_contact.rb +11 -0
- data/spec/test_app/db/migrate/20150423143754_add_deleted_at_to_mailing.rb +11 -0
- data/spec/test_app/db/schema.rb +10 -5
- data/spec/test_app/db/structure.sql +150 -15
- data/spec/test_app/features/bounce_management.feature +11 -0
- data/spec/test_app/features/contact_management.feature +91 -0
- data/{features → spec/test_app/features}/mailable.feature +3 -1
- data/spec/test_app/features/mailing_list_management.feature +39 -0
- data/spec/test_app/features/mailing_management.feature +60 -0
- data/{features → spec/test_app/features}/message.feature +4 -4
- data/spec/test_app/features/message_management.feature +22 -0
- data/spec/test_app/features/step_definitions/bounce_steps.rb +4 -0
- data/spec/test_app/features/step_definitions/contact_steps.rb +63 -0
- data/spec/test_app/features/step_definitions/debugging_steps.rb +3 -0
- data/spec/test_app/features/step_definitions/email_steps.rb +6 -0
- data/spec/test_app/features/step_definitions/job_steps.rb +25 -0
- data/spec/test_app/features/step_definitions/login_steps.rb +4 -0
- data/spec/test_app/features/step_definitions/mailing_list.rb +17 -0
- data/spec/test_app/features/step_definitions/mailing_steps.rb +51 -0
- data/spec/test_app/features/step_definitions/subscription_steps.rb +26 -0
- data/{features → spec/test_app/features}/step_definitions/webrat_steps.rb +10 -6
- data/spec/test_app/features/subscription_management.feature +62 -0
- data/spec/test_app/features/support/env.rb +37 -0
- data/spec/test_app/features/support/paths.rb +36 -0
- data/spec/test_app/lib/debugging.rb +61 -0
- data/spec/test_app/lib/post_office_manager.rb +71 -0
- data/spec/test_app/public/subscribe.html +40 -0
- data/spec/test_app/script/full_suite +50 -0
- data/spec/test_app/script/post_office +25 -0
- data/spec/test_app/script/rails +20 -0
- data/spec/test_app/script/rspec_multi_db +34 -0
- data/spec/test_app/spec/controllers/mail_manager/bounces_controller_spec.rb +59 -0
- data/spec/test_app/spec/controllers/mail_manager/contacts_controller_spec.rb +178 -0
- data/spec/test_app/spec/controllers/mail_manager/mailing_lists_controller_spec.rb +164 -0
- data/spec/test_app/spec/controllers/mail_manager/mailings_controller_spec.rb +184 -0
- data/spec/test_app/spec/controllers/users_controller_spec.rb +47 -46
- data/spec/test_app/spec/factories/_functions.rb +27 -0
- data/spec/test_app/spec/factories/contacts.rb +7 -0
- data/spec/test_app/spec/factories/mail_manager_bounces.rb +13 -0
- data/spec/test_app/spec/factories/mailable.rb +8 -0
- data/spec/test_app/spec/factories/mailings.rb +7 -1
- data/spec/test_app/spec/factories/message.rb +7 -0
- data/spec/test_app/spec/factories/users.rb +19 -7
- data/spec/test_app/spec/features/mail_manager/bounce_spec.rb +73 -0
- data/spec/test_app/spec/features/mail_manager/double_opt_in_spec.rb +62 -0
- data/spec/test_app/spec/features/mail_manager/mailing_spec.rb +46 -0
- data/spec/test_app/spec/features/navigation_spec.rb +9 -0
- data/spec/test_app/spec/helpers/mail_manager/layout_helper_spec.rb +41 -0
- data/spec/test_app/spec/helpers/mail_manager/subscriptions_helper_spec.rb +14 -0
- data/spec/test_app/spec/models/delayed/mailer_spec.rb +27 -0
- data/spec/test_app/spec/models/delayed/status_job_spec.rb +13 -0
- data/spec/test_app/spec/models/delayed/status_spec.rb +37 -0
- data/spec/test_app/spec/models/mail_manager/bounce_spec.rb +23 -3
- data/spec/test_app/spec/models/mail_manager/engine_spec.rb +79 -0
- data/spec/test_app/spec/models/mail_manager/mailable_spec.rb +10 -0
- data/spec/test_app/spec/models/mail_manager/mailer_spec.rb +35 -3
- data/spec/test_app/spec/models/mail_manager/mailing_list_spec.rb +5 -5
- data/spec/test_app/spec/models/mail_manager/mailing_spec.rb +58 -0
- data/spec/test_app/spec/models/mail_manager/message_spec.rb +112 -0
- data/spec/test_app/spec/models/user_spec.rb +10 -8
- data/spec/test_app/spec/rails_helper.rb +86 -0
- data/spec/test_app/spec/requests/users_spec.rb +3 -3
- data/spec/test_app/spec/routing/mail_manager/bounces_routing_spec.rb +27 -0
- data/spec/test_app/spec/routing/mail_manager/contacts_routing_spec.rb +36 -0
- data/spec/test_app/spec/routing/mail_manager/mailing_lists_routing_spec.rb +36 -0
- data/spec/test_app/spec/routing/mail_manager/mailings_routing_spec.rb +36 -0
- data/spec/test_app/spec/spec_helper.rb +82 -32
- data/spec/test_app/spec/support/continuance.rb +18 -0
- data/spec/test_app/spec/support/custom_matchers.rb +17 -0
- data/spec/test_app/spec/support/database_cleaner.rb +10 -1
- data/spec/test_app/spec/views/mail_manager/bounces/index.html.erb_spec.rb +32 -0
- data/spec/test_app/spec/views/mail_manager/bounces/show.html.erb_spec.rb +12 -0
- data/spec/test_app/spec/views/users/edit.html.erb_spec.rb +8 -5
- data/spec/test_app/spec/views/users/index.html.erb_spec.rb +10 -19
- data/spec/test_app/spec/views/users/new.html.erb_spec.rb +9 -6
- data/spec/test_app/spec/views/users/show.html.erb_spec.rb +8 -9
- metadata +231 -75
- data/.DS_Store +0 -0
- data/README.rdoc +0 -3
- data/app/.DS_Store +0 -0
- data/app/controllers/mail_manager/base_controller.rb +0 -22
- data/app/models/.DS_Store +0 -0
- data/features/contact_management.feature +0 -24
- data/features/mailing_management.feature +0 -78
- data/features/step_definitions/email_steps.rb +0 -50
- data/features/step_definitions/mlm_steps.rb +0 -11
- data/features/step_definitions/pickle_steps.rb +0 -41
- data/features/subscription_management.feature +0 -17
- data/features/support/env.rb +0 -11
- data/features/support/paths.rb +0 -44
- data/lib/tasks/mail_manager_tasks.rake +0 -4
- data/lib/tasks/rspec.rake +0 -165
- data/spec/test_app/bin/cucumber +0 -7
- data/spec/test_app/bin/rails +0 -10
- data/spec/test_app/bin/rake +0 -7
- data/spec/test_app/bin/rspec +0 -7
- data/spec/test_app/bin/spring +0 -18
- data/spec/test_app/spec/routing/users_routing_spec.rb +0 -35
- data/spec/test_app/spec/support/post_office.rb +0 -13
data/.DS_Store
DELETED
|
Binary file
|
data/README.rdoc
DELETED
data/app/.DS_Store
DELETED
|
Binary file
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
require 'dynamic_form'
|
|
2
|
-
class MailManager::BaseController < ApplicationController
|
|
3
|
-
layout MailManager.layout
|
|
4
|
-
helper_method :title, :use_show_for_resources?, :site_url
|
|
5
|
-
|
|
6
|
-
def title(value=nil)
|
|
7
|
-
@title = value if value.present?
|
|
8
|
-
@title
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def use_show_for_resources?
|
|
12
|
-
MailManager.use_show_for_resources
|
|
13
|
-
rescue
|
|
14
|
-
false
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def site_url
|
|
18
|
-
MailManager.site_url
|
|
19
|
-
rescue
|
|
20
|
-
"#{default_url_options[:protocol]||'http'}://#{default_url_options[:domain]}"
|
|
21
|
-
end
|
|
22
|
-
end
|
data/app/models/.DS_Store
DELETED
|
Binary file
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
Feature: Manage Contacts
|
|
2
|
-
In order to value
|
|
3
|
-
As a role
|
|
4
|
-
I want feature
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Scenario: Search Contacts that exist
|
|
8
|
-
Given a contact: "Bob" exists with email_address: "bob@example.com"
|
|
9
|
-
And I am logged in and authorized for everything
|
|
10
|
-
When I go to the mail mgr contacts page
|
|
11
|
-
And I fill in "term" with "bob"
|
|
12
|
-
And I press "Search"
|
|
13
|
-
Then I should be on the mail mgr contacts page
|
|
14
|
-
And I should see "bob@example.com"
|
|
15
|
-
|
|
16
|
-
Scenario: Search Contacts that don't exist
|
|
17
|
-
Given a contact: "Bob" exists with email_address: "bob@example.com"
|
|
18
|
-
And I am logged in and authorized for everything
|
|
19
|
-
When I go to the mail mgr contacts page
|
|
20
|
-
And I fill in "term" with "sam"
|
|
21
|
-
And I press "Search"
|
|
22
|
-
Then I should be on the mail mgr contacts page
|
|
23
|
-
And I should not see "sam"
|
|
24
|
-
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
Feature: Mailing Management
|
|
2
|
-
In order send mailings to my mailing list
|
|
3
|
-
As a valid user
|
|
4
|
-
I want to create, modify, schedule and cancel mailings
|
|
5
|
-
|
|
6
|
-
Background:
|
|
7
|
-
Given the following mlm mailable records
|
|
8
|
-
| name | email_html | email_text | reusable |
|
|
9
|
-
| June Newsletter | <head><title>June Newsletter</title><body>June Newsletter</body></html> | June Newsletter | false |
|
|
10
|
-
| July Newsletter | <head><title>July Newsletter</title><body>July Newsletter</body></html> | July Newsletter | true |
|
|
11
|
-
And the following mlm mailing list records
|
|
12
|
-
| name |
|
|
13
|
-
| The Mailing List |
|
|
14
|
-
|
|
15
|
-
Scenario: mailings are created by a valid user
|
|
16
|
-
When I go to the mlm mailings page
|
|
17
|
-
And I follow "New Mailing"
|
|
18
|
-
And I fill in "mailing[subject]" with "Fun Fun Fun July 2009"
|
|
19
|
-
And I select "July Newsletter" from "mailing[mailable]"
|
|
20
|
-
And I press "Save"
|
|
21
|
-
Then I should be on the mlm mailings page
|
|
22
|
-
And I should see "Fun Fun Fun"
|
|
23
|
-
And I should see "pending"
|
|
24
|
-
#And I should see "Send Test"
|
|
25
|
-
And I should see "Schedule"
|
|
26
|
-
And I should see "Edit"
|
|
27
|
-
And an mlm mailing should exist with subject: "Fun Fun Fun July 2009"
|
|
28
|
-
|
|
29
|
-
Scenario: edit a mailing
|
|
30
|
-
Given the following mlm mailing records
|
|
31
|
-
| subject |
|
|
32
|
-
| Fun Fun Fun July 2009 |
|
|
33
|
-
When I go to the mlm mailings page
|
|
34
|
-
And I follow "Edit"
|
|
35
|
-
And I fill in "mailing[subject]" with "Fun! Fun! Fun! July 2009"
|
|
36
|
-
And I press "Save"
|
|
37
|
-
And I should see "Fun! Fun! Fun! July 2009"
|
|
38
|
-
And I should see "pending"
|
|
39
|
-
And I should see "Send Test"
|
|
40
|
-
And I should see "Schedule"
|
|
41
|
-
And I should see "Edit"
|
|
42
|
-
|
|
43
|
-
Scenario: schedule a mailing
|
|
44
|
-
Given the following mlm mailing records
|
|
45
|
-
| subject |
|
|
46
|
-
| Fun Fun Fun July 2009 |
|
|
47
|
-
When I go to the mlm mailings page
|
|
48
|
-
And I follow "Schedule"
|
|
49
|
-
Then I should see "Fun Fun Fun"
|
|
50
|
-
And I should see "scheduled"
|
|
51
|
-
#And I should see "Send Test"
|
|
52
|
-
And I should see "Edit"
|
|
53
|
-
And I should see "Cancel"
|
|
54
|
-
|
|
55
|
-
Scenario: Cancel a mailing
|
|
56
|
-
Given the following mlm mailing records
|
|
57
|
-
| subject | status |
|
|
58
|
-
| Fun Fun Fun July 2009 | scheduled |
|
|
59
|
-
When I go to the mlm mailings page
|
|
60
|
-
And I follow "Cancel"
|
|
61
|
-
Then I should see "Fun Fun Fun"
|
|
62
|
-
And I should see "pending"
|
|
63
|
-
And I should see "Send Test"
|
|
64
|
-
And I should see "Edit"
|
|
65
|
-
|
|
66
|
-
Scenario: send a test message for mailing
|
|
67
|
-
Given the following mlm mailing records
|
|
68
|
-
| subject | status | scheduled_at |
|
|
69
|
-
| Fun Fun Fun July 2009 | scheduled | Time.now |
|
|
70
|
-
When I go to the mlm mailings page
|
|
71
|
-
And I follow "Send Test"
|
|
72
|
-
And I fill in "test_email_addresses" with "test@example.com"
|
|
73
|
-
And I press "Send Test Email"
|
|
74
|
-
Then I should see "scheduled"
|
|
75
|
-
And I should see "Send Test"
|
|
76
|
-
And I should see "Edit"
|
|
77
|
-
And I should see "Cancel"
|
|
78
|
-
And an email is sent to "test@example.com" with subject: "Fun Fun Fun July 2009"
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# this file generated by script/generate pickle email
|
|
2
|
-
|
|
3
|
-
ActionMailer::Base.delivery_method = :test
|
|
4
|
-
ActionMailer::Base.perform_deliveries = true
|
|
5
|
-
|
|
6
|
-
Before do
|
|
7
|
-
ActionMailer::Base.deliveries.clear
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
Given(/^all emails? (?:have|has) been delivered$/) do
|
|
11
|
-
ActionMailer::Base.deliveries.clear
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
Given(/^(\d)+ emails? should be delivered$/) do |count|
|
|
15
|
-
emails.size.should == count.to_i
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
Then(/^(\d)+ emails? should be delivered to (.*)$/) do |count, to|
|
|
19
|
-
to =~ /^#{capture_model}$/ && to = model($1).email
|
|
20
|
-
emails("to: \"#{to}\"").size.should == count.to_i
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
Then(/^(\d)+ emails? should be delivered with #{capture_fields}$/) do |count, fields|
|
|
24
|
-
emails(fields).size.should == count.to_i
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
Then(/^#{capture_email} should be delivered to (.+)$/) do |email_ref, to|
|
|
28
|
-
to =~ /^#{capture_model}$/ && to = model($1).email
|
|
29
|
-
email(email_ref, "to: \"#{to}\"").should_not be_nil
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
Then(/^#{capture_email} should have #{capture_fields}$/) do |email_ref, fields|
|
|
33
|
-
email(email_ref, fields).should_not be_nil
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
Then(/^#{capture_email} should contain "(.*)"$/) do |email_ref, text|
|
|
37
|
-
email(email_ref).body.should =~ /#{text}/
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
Then(/^#{capture_email} should not contain "(.*)"$/) do |email_ref, text|
|
|
41
|
-
email(email_ref).body.should_not =~ /#{text}/
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
Then(/^#{capture_email} should link to (.+)$/) do |email_ref, page|
|
|
45
|
-
email(email_ref).body.should =~ /#{path_to(page)}/
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
Then(/^show me the emails?$/) do
|
|
49
|
-
save_and_open_emails
|
|
50
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Then /^contact: "([^"]*)" subscribes to mailing list: "([^"]*)"$/ do |contact_name, mailing_list_name|
|
|
2
|
-
contact = model(%Q|contact: "#{contact_name}"|)
|
|
3
|
-
mailing_list = model(%Q|mailing_list: "#{mailing_list_name}"|)
|
|
4
|
-
contact.subscribe(mailing_list)
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
Then /^contact: "([^"]*)" should not be subscribed to mailing list: "([^"]*)"$/ do |contact_name, mailing_list_name|
|
|
8
|
-
contact = model(%Q|contact: "#{contact_name}"|)
|
|
9
|
-
mailing_list = model(%Q|mailing_list: "#{mailing_list_name}"|)
|
|
10
|
-
contact.subscriptions.detect{|subscription| subscription.active? and subscription.mailing_list == mailing_list}.should be_nil
|
|
11
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# this file generated by script/generate pickle
|
|
2
|
-
|
|
3
|
-
# create a model
|
|
4
|
-
Given(/^#{capture_model} exists?(?: with #{capture_fields})?$/) do |name, fields|
|
|
5
|
-
create_model(name, fields)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
# create n models
|
|
9
|
-
Given(/^(\d+) #{capture_plural_factory} exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
|
|
10
|
-
count.to_i.times { create_model(plural_factory.singularize, fields) }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# find a model
|
|
14
|
-
Then(/^#{capture_model} should exist(?: with #{capture_fields})?$/) do |name, fields|
|
|
15
|
-
find_model(name, fields).should_not be_nil
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# find exactly n models
|
|
19
|
-
Then(/^(\d+) #{capture_plural_factory} should exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
|
|
20
|
-
find_models(plural_factory.singularize, fields).size.should == count.to_i
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# assert model is in another model's has_many assoc
|
|
24
|
-
Then(/^#{capture_model} should be (?:in|one of|amongst) #{capture_model}'s (\w+)$/) do |target, owner, association|
|
|
25
|
-
model(owner).send(association).should include(model(target))
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# assert model is another model's has_one/belongs_to assoc
|
|
29
|
-
Then(/^#{capture_model} should be #{capture_model}'s (\w+)$/) do |target, owner, association|
|
|
30
|
-
model(owner).send(association).should == model(target)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# assert model.predicate?
|
|
34
|
-
Then(/^#{capture_model} should (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
|
|
35
|
-
model(name).should send("be_#{predicate.gsub(' ', '_')}")
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# assert not model.predicate?
|
|
39
|
-
Then(/^#{capture_model} should not (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
|
|
40
|
-
model(name).should_not send("be_#{predicate.gsub(' ', '_')}")
|
|
41
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
Feature: Manage Subscriptions
|
|
2
|
-
In order to have a list of email addresses to send messages to
|
|
3
|
-
As an administrator
|
|
4
|
-
I want to manage a contact's subscriptions
|
|
5
|
-
|
|
6
|
-
Scenario: Unsubscribe sends an email
|
|
7
|
-
Given a mailing: "Mailing" exists
|
|
8
|
-
And a mailing_list: "List1" exists with name: "List1"
|
|
9
|
-
And mailing_list: "List1" is one of mailing: "Mailing"'s mailing_lists
|
|
10
|
-
And a mailing_list: "List2" exists with name: "List2"
|
|
11
|
-
And mailing_list: "List2" is one of mailing: "Mailing"'s mailing_lists
|
|
12
|
-
And a mailing_list: "List3" exists with name: "List3"
|
|
13
|
-
And a mailing_list: "List4" exists with name: "List4"
|
|
14
|
-
And a contact: "Bob" exists with email_address: "bob@example.com"
|
|
15
|
-
And contact: "Bob" is subscribed to "List1, List3"
|
|
16
|
-
And mailing: "Mailing"'s "deliver" should "be_true"
|
|
17
|
-
|
data/features/support/env.rb
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Sets up the Rails environment for Cucumber
|
|
2
|
-
ENV["RAILS_ENV"] ||= "test"
|
|
3
|
-
ENV["RAILS_ROOT"] ||= File.dirname(__FILE__) + "/../../spec/test_app"
|
|
4
|
-
require File.expand_path(ENV['RAILS_ROOT'] + "/config/environment.rb")
|
|
5
|
-
require 'database_cleaner'
|
|
6
|
-
require 'cucumber/rails/world'
|
|
7
|
-
require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support
|
|
8
|
-
|
|
9
|
-
`rake db:schema:load`
|
|
10
|
-
|
|
11
|
-
#require "#{MailManager::PLUGIN_ROOT}/spec/factories"
|
data/features/support/paths.rb
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
module NavigationHelpers
|
|
2
|
-
# Maps a name to a path. Used by the
|
|
3
|
-
#
|
|
4
|
-
# When /^I go to (.+)$/ do |page_name|
|
|
5
|
-
#
|
|
6
|
-
# step definition in webrat_steps.rb
|
|
7
|
-
#
|
|
8
|
-
def path_to(page_name)
|
|
9
|
-
case page_name
|
|
10
|
-
|
|
11
|
-
when /the homepage/
|
|
12
|
-
'/'
|
|
13
|
-
|
|
14
|
-
# Add more mappings here.
|
|
15
|
-
# Here is a more fancy example:
|
|
16
|
-
#
|
|
17
|
-
# when /^(.*)'s profile page$/i
|
|
18
|
-
# user_profile_path(User.find_by_login($1))
|
|
19
|
-
# added by script/generate pickle path
|
|
20
|
-
|
|
21
|
-
when /^#{capture_model}(?:'s)? page$/ # eg. the forum's page
|
|
22
|
-
path_to_pickle $1
|
|
23
|
-
|
|
24
|
-
when /^#{capture_model}(?:'s)? #{capture_model}(?:'s)? page$/ # eg. the forum's post's page
|
|
25
|
-
path_to_pickle $1, $2
|
|
26
|
-
|
|
27
|
-
when /^#{capture_model}(?:'s)? #{capture_model}'s (.+?) page$/ # eg. the forum's post's comments page
|
|
28
|
-
path_to_pickle $1, $2, :extra => $3 # or the forum's post's edit page
|
|
29
|
-
|
|
30
|
-
when /^#{capture_model}(?:'s)? (.+?) page$/ # eg. the forum's posts page
|
|
31
|
-
path_to_pickle $1, :extra => $2 # or the forum's edit page
|
|
32
|
-
|
|
33
|
-
when /^the (.+?) page$/ # translate to named route
|
|
34
|
-
send "#{$1.downcase.gsub(' ','_')}_path"
|
|
35
|
-
|
|
36
|
-
# end added by pickle path
|
|
37
|
-
else
|
|
38
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
|
39
|
-
"Now, go and add a mapping in #{__FILE__}"
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
World(NavigationHelpers)
|
data/lib/tasks/rspec.rake
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
|
|
2
|
-
|
|
3
|
-
# # Don't load rspec if running "rake gems:*"
|
|
4
|
-
# unless ARGV.any? {|a| a =~ /^gems/}
|
|
5
|
-
|
|
6
|
-
# begin
|
|
7
|
-
# require 'spec/rake/spectask'
|
|
8
|
-
# rescue MissingSourceFile
|
|
9
|
-
# module Spec
|
|
10
|
-
# module Rake
|
|
11
|
-
# class SpecTask
|
|
12
|
-
# def initialize(name)
|
|
13
|
-
# task name do
|
|
14
|
-
# # if rspec-rails is a configured gem, this will output helpful material and exit ...
|
|
15
|
-
# require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
|
|
16
|
-
|
|
17
|
-
# # ... otherwise, do this:
|
|
18
|
-
# raise <<-MSG
|
|
19
|
-
|
|
20
|
-
# #{"*" * 80}
|
|
21
|
-
# * You are trying to run an rspec rake task defined in
|
|
22
|
-
# * #{__FILE__},
|
|
23
|
-
# * but rspec can not be found in vendor/gems, vendor/plugins or system gems.
|
|
24
|
-
# #{"*" * 80}
|
|
25
|
-
# MSG
|
|
26
|
-
# end
|
|
27
|
-
# end
|
|
28
|
-
# end
|
|
29
|
-
# end
|
|
30
|
-
# end
|
|
31
|
-
# end
|
|
32
|
-
|
|
33
|
-
# Rake.application.instance_variable_get('@tasks').delete('default')
|
|
34
|
-
|
|
35
|
-
# spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
|
|
36
|
-
# task :noop do
|
|
37
|
-
# end
|
|
38
|
-
|
|
39
|
-
# task :default => :spec
|
|
40
|
-
# task :stats => "spec:statsetup"
|
|
41
|
-
|
|
42
|
-
# desc "Run all specs in spec directory (excluding plugin specs)"
|
|
43
|
-
# Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
|
|
44
|
-
# t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
|
45
|
-
# t.spec_files = FileList['spec/**/*/*_spec.rb']
|
|
46
|
-
# end
|
|
47
|
-
|
|
48
|
-
# namespace :spec do
|
|
49
|
-
# desc "Run all specs in spec directory with RCov (excluding plugin specs)"
|
|
50
|
-
# Spec::Rake::SpecTask.new(:rcov) do |t|
|
|
51
|
-
# t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
|
52
|
-
# t.spec_files = FileList['spec/**/*/*_spec.rb']
|
|
53
|
-
# t.rcov = true
|
|
54
|
-
# t.rcov_opts = lambda do
|
|
55
|
-
# IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
|
56
|
-
# end
|
|
57
|
-
# end
|
|
58
|
-
|
|
59
|
-
# desc "Print Specdoc for all specs (excluding plugin specs)"
|
|
60
|
-
# Spec::Rake::SpecTask.new(:doc) do |t|
|
|
61
|
-
# t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
|
62
|
-
# t.spec_files = FileList['spec/**/*/*_spec.rb']
|
|
63
|
-
# end
|
|
64
|
-
|
|
65
|
-
# desc "Print Specdoc for all plugin examples"
|
|
66
|
-
# Spec::Rake::SpecTask.new(:plugin_doc) do |t|
|
|
67
|
-
# t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
|
68
|
-
# t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*')
|
|
69
|
-
# end
|
|
70
|
-
|
|
71
|
-
# [:models, :controllers, :views, :helpers, :lib].each do |sub|
|
|
72
|
-
# desc "Run the code examples in spec/#{sub}"
|
|
73
|
-
# Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
|
|
74
|
-
# t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
|
75
|
-
# t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
|
|
76
|
-
# end
|
|
77
|
-
# end
|
|
78
|
-
|
|
79
|
-
# desc "Run the code examples in vendor/plugins (except RSpec's own)"
|
|
80
|
-
# Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
|
|
81
|
-
# t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
|
82
|
-
# t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
|
|
83
|
-
# end
|
|
84
|
-
|
|
85
|
-
# namespace :plugins do
|
|
86
|
-
# desc "Runs the examples for rspec_on_rails"
|
|
87
|
-
# Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
|
|
88
|
-
# t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
|
89
|
-
# t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*/*_spec.rb']
|
|
90
|
-
# end
|
|
91
|
-
# end
|
|
92
|
-
|
|
93
|
-
# # Setup specs for stats
|
|
94
|
-
# task :statsetup do
|
|
95
|
-
# require 'code_statistics'
|
|
96
|
-
# ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
|
|
97
|
-
# ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
|
|
98
|
-
# ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
|
|
99
|
-
# ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
|
|
100
|
-
# ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
|
|
101
|
-
# ::STATS_DIRECTORIES << %w(Routing\ specs spec/lib) if File.exist?('spec/routing')
|
|
102
|
-
# ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
|
|
103
|
-
# ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
|
|
104
|
-
# ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
|
|
105
|
-
# ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
|
|
106
|
-
# ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
|
|
107
|
-
# ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
|
|
108
|
-
# end
|
|
109
|
-
|
|
110
|
-
# namespace :db do
|
|
111
|
-
# namespace :fixtures do
|
|
112
|
-
# desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
|
|
113
|
-
# task :load => :environment do
|
|
114
|
-
# ActiveRecord::Base.establish_connection(Rails.env)
|
|
115
|
-
# base_dir = File.join(Rails.root, 'spec', 'fixtures')
|
|
116
|
-
# fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
|
|
117
|
-
|
|
118
|
-
# require 'active_record/fixtures'
|
|
119
|
-
# (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
|
|
120
|
-
# Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
|
|
121
|
-
# end
|
|
122
|
-
# end
|
|
123
|
-
# end
|
|
124
|
-
# end
|
|
125
|
-
|
|
126
|
-
# namespace :server do
|
|
127
|
-
# daemonized_server_pid = File.expand_path("#{RAILS_ROOT}/tmp/pids/spec_server.pid")
|
|
128
|
-
|
|
129
|
-
# desc "start spec_server."
|
|
130
|
-
# task :start do
|
|
131
|
-
# if File.exist?(daemonized_server_pid)
|
|
132
|
-
# $stderr.puts "spec_server is already running."
|
|
133
|
-
# else
|
|
134
|
-
# $stderr.puts %Q{Starting up spec_server ...}
|
|
135
|
-
# FileUtils.mkdir_p('tmp/pids') unless test ?d, 'tmp/pids'
|
|
136
|
-
# system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
|
|
137
|
-
# end
|
|
138
|
-
# end
|
|
139
|
-
|
|
140
|
-
# desc "stop spec_server."
|
|
141
|
-
# task :stop do
|
|
142
|
-
# unless File.exist?(daemonized_server_pid)
|
|
143
|
-
# $stderr.puts "No server running."
|
|
144
|
-
# else
|
|
145
|
-
# $stderr.puts "Shutting down spec_server ..."
|
|
146
|
-
# system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
|
|
147
|
-
# File.delete(daemonized_server_pid)
|
|
148
|
-
# end
|
|
149
|
-
# end
|
|
150
|
-
|
|
151
|
-
# desc "restart spec_server."
|
|
152
|
-
# task :restart => [:stop, :start]
|
|
153
|
-
|
|
154
|
-
# desc "check if spec server is running"
|
|
155
|
-
# task :status do
|
|
156
|
-
# if File.exist?(daemonized_server_pid)
|
|
157
|
-
# $stderr.puts %Q{spec_server is running (PID: #{File.read(daemonized_server_pid).gsub("\n","")})}
|
|
158
|
-
# else
|
|
159
|
-
# $stderr.puts "No server running."
|
|
160
|
-
# end
|
|
161
|
-
# end
|
|
162
|
-
# end
|
|
163
|
-
# end
|
|
164
|
-
|
|
165
|
-
# end
|