Permalink
Browse files

WIP admin should send out newsletter via admin interface

  • Loading branch information...
1 parent eedc28f commit 291deb732ba68f55077cf3df3ce36b9525308b8c @wolli2710 wolli2710 committed Mar 6, 2012
@@ -0,0 +1,3 @@
+ActiveAdmin.register NewsletterSubscriber do
+
+end
View
@@ -5,10 +5,6 @@
column :body
column :sent
- # do
- # strong { link_to "Send Newsletter", update_newsletter_path() }
- # end
-
default_actions
end
end
View
@@ -1,3 +0,0 @@
-ActiveAdmin.register Subscriber do
-
-end
@@ -14,6 +14,13 @@
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true
+
+ #Workaround for active_admin
+ config.before_eager_load do
+ I18n.locale = :de
+ I18n.load_path += Dir[Rails.root.join('config', 'locales', 'de.yml').to_s]
+ I18n.reload!
+ end
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
View
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120306115840) do
+ActiveRecord::Schema.define(:version => 20120306153031) do
create_table "active_admin_comments", :force => true do |t|
t.string "resource_id", :null => false
@@ -28,18 +28,22 @@ class NewsletterSubscriberTest < ActiveSupport::TestCase
end
should 'be able to signout from newsletter' do
- newsletter = Factory.create(:newsletter)
+ newsletter1 = Factory.create(:newsletter)
subscriber1 = Factory.create(:newsletter_subscriber)
subscriber2 = Factory.create(:newsletter_subscriber)
assert_difference "ActionMailer::Base.deliveries.count", 2 do
- Newsletter.spread_newsletter(newsletter.id)
+ Newsletter.spread_newsletter(newsletter1.id)
end
+
assert_difference "NewsletterSubscriber.count", -1 do
NewsletterSubscriber.unsubscribe(subscriber2.signout_hash)
end
+
assert_difference "ActionMailer::Base.deliveries.count" do
+ newsletter2 = Factory.create(:newsletter)
Newsletter.spread_newsletter
end
+
end
end
@@ -21,6 +21,7 @@ class NewsletterTest < ActiveSupport::TestCase
end
should 'send email to subscribers' do
+ newsletter = Factory.create(:newsletter)
subscriber1 = Factory.create(:newsletter_subscriber)
subscriber2 = Factory.create(:newsletter_subscriber)
assert_difference "ActionMailer::Base.deliveries.count", 2 do
@@ -30,7 +31,7 @@ class NewsletterTest < ActiveSupport::TestCase
should 'send email to subscribers only once' do
newsletter = Factory.create(:newsletter)
- subscriber = Factory.create(:subscriber, :newsletter_id => newsletter.id)
+ subscriber = Factory.create(:newsletter_subscriber)
assert_difference "ActionMailer::Base.deliveries.count" do
Newsletter.spread_newsletter
end

0 comments on commit 291deb7

Please sign in to comment.