fixed some more deprecations. 20 to go

This commit is contained in:
Régis Hanol 2014-10-29 16:06:50 +01:00
parent 44ff357e1c
commit ada750b384
6 changed files with 58 additions and 35 deletions

View file

@ -25,7 +25,7 @@ describe Email::Styles do
end
# 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'>")
expect(frag.at("img")["style"]).to match("max-width")
end

View file

@ -41,7 +41,7 @@ describe PrettyText do
end
# see: https://github.com/sparklemotion/nokogiri/issues/1173
pending 'allows html entities correctly' do
skip 'allows html entities correctly' do
PrettyText.cook("&aleph;&pound;&#162;").should == "<p>&aleph;&pound;&#162;</p>"
end

View file

@ -25,46 +25,56 @@ describe UserNotifications do
end
describe ".signup" do
subject { UserNotifications.signup(user) }
its(:to) { should == [user.email] }
its(:subject) { should be_present }
its(:from) { should == [SiteSetting.notification_email] }
its(:body) { should be_present }
it "works" do
subject.to.should == [user.email]
subject.subject.should be_present
subject.from.should == [SiteSetting.notification_email]
subject.body.should be_present
end
end
describe ".forgot_password" do
subject { UserNotifications.forgot_password(user) }
its(:to) { should == [user.email] }
its(:subject) { should be_present }
its(:from) { should == [SiteSetting.notification_email] }
its(:body) { should be_present }
it "works" do
subject.to.should == [user.email]
subject.subject.should be_present
subject.from.should == [SiteSetting.notification_email]
subject.body.should be_present
end
end
describe '.digest' do
subject { UserNotifications.digest(user) }
context "without new topics" do
its(:to) { should be_blank }
it "doesn't send the email" do
subject.to.should be_blank
end
end
context "with new topics" do
before do
Topic.expects(:for_digest).returns([Fabricate(:topic, user: Fabricate(:coding_horror))])
Topic.expects(:new_since_last_seen).returns(Topic.none)
end
its(:to) { should == [user.email] }
its(:subject) { should be_present }
its(: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
it "works" do
subject.to.should == [user.email]
subject.subject.should be_present
subject.from.should == [SiteSetting.notification_email]
subject.html_part.body.to_s.should be_present
subject.text_part.body.to_s.should be_present
end
end

View file

@ -5,14 +5,21 @@ describe VersionMailer do
context 'contact_email is blank' do
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
context 'contact_email is set' do
before { SiteSetting.stubs(:contact_email).returns('me@example.com') }
its(:to) { should == ['me@example.com'] }
its(:subject) { should be_present }
its(:from) { should == [SiteSetting.notification_email] }
its(:body) { should be_present }
it "works" do
subject.to.should == ['me@example.com']
subject.subject.should be_present
subject.from.should == [SiteSetting.notification_email]
subject.body.should be_present
end
end
end

View file

@ -40,8 +40,11 @@ describe Invite do
context 'saved' do
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
subject.email.should == iceking

View file

@ -206,10 +206,13 @@ describe User do
it { should be_valid }
it { should_not be_admin }
it { should_not be_approved }
its(:approved_at) { should be_blank }
its(:approved_by_id) { should be_blank }
its(:email_private_messages) { should == true }
its(:email_direct ) { should == true }
it "is properly initialized" do
subject.approved_at.should be_blank
subject.approved_by_id.should be_blank
subject.email_private_messages.should == true
subject.email_direct.should == true
end
context 'digest emails' do
it 'defaults to digests every week' do
@ -230,11 +233,11 @@ describe User do
end
context 'after_save' do
before do
subject.save
end
before { subject.save }
its(:email_tokens) { should be_present }
it "has an email token" do
subject.email_tokens.should be_present
end
end
it "downcases email addresses" do