mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
fixed some more deprecations. 20 to go
This commit is contained in:
parent
44ff357e1c
commit
ada750b384
6 changed files with 58 additions and 35 deletions
|
@ -25,7 +25,7 @@ describe Email::Styles do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Pending due to email effort @coding-horror made in d2fb2bc4c
|
# Pending due to email effort @coding-horror made in d2fb2bc4c
|
||||||
pending "adds a max-width to images" do
|
skip "adds a max-width to images" do
|
||||||
frag = basic_fragment("<img src='gigantic.jpg'>")
|
frag = basic_fragment("<img src='gigantic.jpg'>")
|
||||||
expect(frag.at("img")["style"]).to match("max-width")
|
expect(frag.at("img")["style"]).to match("max-width")
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,7 +41,7 @@ describe PrettyText do
|
||||||
end
|
end
|
||||||
|
|
||||||
# see: https://github.com/sparklemotion/nokogiri/issues/1173
|
# see: https://github.com/sparklemotion/nokogiri/issues/1173
|
||||||
pending 'allows html entities correctly' do
|
skip 'allows html entities correctly' do
|
||||||
PrettyText.cook("ℵ£¢").should == "<p>ℵ£¢</p>"
|
PrettyText.cook("ℵ£¢").should == "<p>ℵ£¢</p>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -25,46 +25,56 @@ describe UserNotifications do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".signup" do
|
describe ".signup" do
|
||||||
|
|
||||||
subject { UserNotifications.signup(user) }
|
subject { UserNotifications.signup(user) }
|
||||||
|
|
||||||
its(:to) { should == [user.email] }
|
it "works" do
|
||||||
its(:subject) { should be_present }
|
subject.to.should == [user.email]
|
||||||
its(:from) { should == [SiteSetting.notification_email] }
|
subject.subject.should be_present
|
||||||
its(:body) { should be_present }
|
subject.from.should == [SiteSetting.notification_email]
|
||||||
|
subject.body.should be_present
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".forgot_password" do
|
describe ".forgot_password" do
|
||||||
|
|
||||||
subject { UserNotifications.forgot_password(user) }
|
subject { UserNotifications.forgot_password(user) }
|
||||||
|
|
||||||
its(:to) { should == [user.email] }
|
it "works" do
|
||||||
its(:subject) { should be_present }
|
subject.to.should == [user.email]
|
||||||
its(:from) { should == [SiteSetting.notification_email] }
|
subject.subject.should be_present
|
||||||
its(:body) { should be_present }
|
subject.from.should == [SiteSetting.notification_email]
|
||||||
|
subject.body.should be_present
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.digest' do
|
describe '.digest' do
|
||||||
|
|
||||||
subject { UserNotifications.digest(user) }
|
subject { UserNotifications.digest(user) }
|
||||||
|
|
||||||
context "without new topics" do
|
context "without new topics" do
|
||||||
its(:to) { should be_blank }
|
|
||||||
|
it "doesn't send the email" do
|
||||||
|
subject.to.should be_blank
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with new topics" do
|
context "with new topics" do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Topic.expects(:for_digest).returns([Fabricate(:topic, user: Fabricate(:coding_horror))])
|
Topic.expects(:for_digest).returns([Fabricate(:topic, user: Fabricate(:coding_horror))])
|
||||||
Topic.expects(:new_since_last_seen).returns(Topic.none)
|
Topic.expects(:new_since_last_seen).returns(Topic.none)
|
||||||
end
|
end
|
||||||
|
|
||||||
its(:to) { should == [user.email] }
|
it "works" do
|
||||||
its(:subject) { should be_present }
|
subject.to.should == [user.email]
|
||||||
its(:from) { should == [SiteSetting.notification_email] }
|
subject.subject.should be_present
|
||||||
|
subject.from.should == [SiteSetting.notification_email]
|
||||||
it 'should have a html body' do
|
|
||||||
subject.html_part.body.to_s.should be_present
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should have a text body' do
|
|
||||||
subject.html_part.body.to_s.should be_present
|
subject.html_part.body.to_s.should be_present
|
||||||
|
subject.text_part.body.to_s.should be_present
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,14 +5,21 @@ describe VersionMailer do
|
||||||
|
|
||||||
context 'contact_email is blank' do
|
context 'contact_email is blank' do
|
||||||
before { SiteSetting.stubs(:contact_email).returns('') }
|
before { SiteSetting.stubs(:contact_email).returns('') }
|
||||||
its(:to) { should be_blank }
|
|
||||||
|
it "doesn't send the email" do
|
||||||
|
subject.to.should be_blank
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'contact_email is set' do
|
context 'contact_email is set' do
|
||||||
before { SiteSetting.stubs(:contact_email).returns('me@example.com') }
|
before { SiteSetting.stubs(:contact_email).returns('me@example.com') }
|
||||||
its(:to) { should == ['me@example.com'] }
|
|
||||||
its(:subject) { should be_present }
|
it "works" do
|
||||||
its(:from) { should == [SiteSetting.notification_email] }
|
subject.to.should == ['me@example.com']
|
||||||
its(:body) { should be_present }
|
subject.subject.should be_present
|
||||||
|
subject.from.should == [SiteSetting.notification_email]
|
||||||
|
subject.body.should be_present
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,8 +40,11 @@ describe Invite do
|
||||||
|
|
||||||
context 'saved' do
|
context 'saved' do
|
||||||
subject { Fabricate(:invite) }
|
subject { Fabricate(:invite) }
|
||||||
its(:invite_key) { should be_present }
|
|
||||||
its(:email_already_exists) { should == false }
|
it "works" do
|
||||||
|
subject.invite_key.should be_present
|
||||||
|
subject.email_already_exists.should == false
|
||||||
|
end
|
||||||
|
|
||||||
it 'should store a lower case version of the email' do
|
it 'should store a lower case version of the email' do
|
||||||
subject.email.should == iceking
|
subject.email.should == iceking
|
||||||
|
|
|
@ -206,10 +206,13 @@ describe User do
|
||||||
it { should be_valid }
|
it { should be_valid }
|
||||||
it { should_not be_admin }
|
it { should_not be_admin }
|
||||||
it { should_not be_approved }
|
it { should_not be_approved }
|
||||||
its(:approved_at) { should be_blank }
|
|
||||||
its(:approved_by_id) { should be_blank }
|
it "is properly initialized" do
|
||||||
its(:email_private_messages) { should == true }
|
subject.approved_at.should be_blank
|
||||||
its(:email_direct ) { should == true }
|
subject.approved_by_id.should be_blank
|
||||||
|
subject.email_private_messages.should == true
|
||||||
|
subject.email_direct.should == true
|
||||||
|
end
|
||||||
|
|
||||||
context 'digest emails' do
|
context 'digest emails' do
|
||||||
it 'defaults to digests every week' do
|
it 'defaults to digests every week' do
|
||||||
|
@ -230,11 +233,11 @@ describe User do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'after_save' do
|
context 'after_save' do
|
||||||
before do
|
before { subject.save }
|
||||||
subject.save
|
|
||||||
end
|
|
||||||
|
|
||||||
its(:email_tokens) { should be_present }
|
it "has an email token" do
|
||||||
|
subject.email_tokens.should be_present
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "downcases email addresses" do
|
it "downcases email addresses" do
|
||||||
|
|
Loading…
Reference in a new issue