Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notifiers now use ActiveRecord::Observer
- Loading branch information
1 parent
e4fcaea
commit 15de129
Showing
15 changed files
with
56 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,3 @@ | |
*.swp | ||
*.DS_Store | ||
public/assets/* | ||
config/quotepad.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,6 +272,7 @@ DEPENDENCIES | |
jquery-rails | ||
kaminari | ||
rails (= 3.2.6) | ||
resque | ||
resque_mailer | ||
resque_spec | ||
rspec-rails | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ExcerptObserver < ActiveRecord::Observer | ||
def after_create(excerpt) | ||
User.subscribers.each do | subscriber | | ||
Notifier.new_excerpt(subscriber.id, excerpt.id).deliver | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class UserObserver < ActiveRecord::Observer | ||
def after_create(user) | ||
Notifier.new_user(user.email, user.password).deliver | ||
end | ||
end | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,6 @@ div | |
div | ||
| Use this data to sign in | ||
p | ||
| Email: #{@user.email} | ||
| Email: #{@email} | ||
p | ||
| Password: #{@password} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ service_name: QuotePad | |
smtp_user: | ||
smtp_password: | ||
mailer_from: admin@quote.pad | ||
url: | ||
url: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'spec_helper' | ||
|
||
describe User do | ||
it { should have_many :excerpts } | ||
it { should belong_to :role } | ||
it { should validate_presence_of :role_id } | ||
describe "should have correct display_name" do | ||
before(:each) do | ||
@email = "fuu@bar.baz" | ||
@user = FactoryGirl.create :user, :email => @email | ||
end | ||
it "without nickname" do | ||
@user.nickname = nil | ||
@user.display_name == @email | ||
end | ||
it "within nickname" do | ||
nickname = "alexd" | ||
@user.nickname = nickname | ||
@user.display_name == nickname | ||
end | ||
it "within empty nickname" do | ||
nickname = "" | ||
@user.display_name == @email | ||
end | ||
|
||
end | ||
end | ||
|
||
|