Remove "should" from example descriptions in a couple of files.
This commit is contained in:
parent
29ebbecf9a
commit
b8343ef963
|
@ -6,34 +6,34 @@ describe Shoulda::Matchers::ActionController::RedirectToMatcher do
|
||||||
@controller = build_response { redirect_to '/some/url' }
|
@controller = build_response { redirect_to '/some/url' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should accept redirecting to that url" do
|
it "accepts redirecting to that url" do
|
||||||
@controller.should redirect_to('/some/url')
|
@controller.should redirect_to('/some/url')
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should reject redirecting to a different url" do
|
it "rejects redirecting to a different url" do
|
||||||
@controller.should_not redirect_to('/some/other/url')
|
@controller.should_not redirect_to('/some/other/url')
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should accept redirecting to that url in a block" do
|
it "accepts redirecting to that url in a block" do
|
||||||
@controller.should redirect_to('somewhere') { '/some/url' }
|
@controller.should redirect_to('somewhere') { '/some/url' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should reject redirecting to a different url in a block" do
|
it "rejects redirecting to a different url in a block" do
|
||||||
@controller.should_not redirect_to('somewhere else') { '/some/other/url' }
|
@controller.should_not redirect_to('somewhere else') { '/some/other/url' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "a controller that doesn't redirect" do
|
context "a controller that doesn't redirect" do
|
||||||
before do
|
before do
|
||||||
@controller = build_response { render :text => 'hello' }
|
@controller = build_response { render :text => 'hello' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should reject redirecting to a url" do
|
it "rejects redirecting to a url" do
|
||||||
@controller.should_not redirect_to('/some/url')
|
@controller.should_not redirect_to('/some/url')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should use the correct description when provided a block" do
|
it "provides the correct description when provided a block" do
|
||||||
matcher = redirect_to('somewhere else') { '/some/other/url' }
|
matcher = redirect_to('somewhere else') { '/some/other/url' }
|
||||||
matcher.description.should == 'redirect to somewhere else'
|
matcher.description.should == 'redirect to somewhere else'
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,42 +20,42 @@ describe Shoulda::Matchers::ActionMailer::HaveSentEmailMatcher do
|
||||||
|
|
||||||
after { ::ActionMailer::Base.deliveries.clear }
|
after { ::ActionMailer::Base.deliveries.clear }
|
||||||
|
|
||||||
it "should accept based on the subject" do
|
it "accepts sent e-mail based on the subject" do
|
||||||
should have_sent_email.with_subject(/is spam$/)
|
should have_sent_email.with_subject(/is spam$/)
|
||||||
matcher = have_sent_email.with_subject(/totally safe/)
|
matcher = have_sent_email.with_subject(/totally safe/)
|
||||||
matcher.matches?(nil)
|
matcher.matches?(nil)
|
||||||
matcher.failure_message.should =~ /Expected sent email with subject/
|
matcher.failure_message.should =~ /Expected sent email with subject/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should accept based on a string sender" do
|
it "accepts sent e-mail based on a string sender" do
|
||||||
should have_sent_email.from('do-not-reply@example.com')
|
should have_sent_email.from('do-not-reply@example.com')
|
||||||
matcher = have_sent_email.from('you@example.com')
|
matcher = have_sent_email.from('you@example.com')
|
||||||
matcher.matches?(nil)
|
matcher.matches?(nil)
|
||||||
matcher.failure_message.should =~ /Expected sent email from/
|
matcher.failure_message.should =~ /Expected sent email from/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should accept based on a regexp sender" do
|
it "accepts sent e-mail based on a regexp sender" do
|
||||||
should have_sent_email.from(/@example\.com/)
|
should have_sent_email.from(/@example\.com/)
|
||||||
matcher = have_sent_email.from(/you@/)
|
matcher = have_sent_email.from(/you@/)
|
||||||
matcher.matches?(nil)
|
matcher.matches?(nil)
|
||||||
matcher.failure_message.should =~ /Expected sent email from/
|
matcher.failure_message.should =~ /Expected sent email from/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should accept based on the body" do
|
it "accepts sent e-mail based on the body" do
|
||||||
should have_sent_email.with_body(/is spam\./)
|
should have_sent_email.with_body(/is spam\./)
|
||||||
matcher = have_sent_email.with_body(/totally safe/)
|
matcher = have_sent_email.with_body(/totally safe/)
|
||||||
matcher.matches?(nil)
|
matcher.matches?(nil)
|
||||||
matcher.failure_message.should =~ /Expected sent email with body/
|
matcher.failure_message.should =~ /Expected sent email with body/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should accept based on the recipient" do
|
it "accept sent e-mail based on the recipient" do
|
||||||
should have_sent_email.to('myself@me.com')
|
should have_sent_email.to('myself@me.com')
|
||||||
matcher = have_sent_email.to('you@example.com')
|
matcher = have_sent_email.to('you@example.com')
|
||||||
matcher.matches?(nil)
|
matcher.matches?(nil)
|
||||||
matcher.failure_message.should =~ /Expected sent email to/
|
matcher.failure_message.should =~ /Expected sent email to/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should list all deliveries within failure message" do
|
it "lists all the deliveries within failure message" do
|
||||||
add_mail_to_deliveries
|
add_mail_to_deliveries
|
||||||
|
|
||||||
matcher = have_sent_email.to('you@example.com')
|
matcher = have_sent_email.to('you@example.com')
|
||||||
|
@ -63,13 +63,13 @@ describe Shoulda::Matchers::ActionMailer::HaveSentEmailMatcher do
|
||||||
matcher.failure_message.should =~ /Deliveries:\n"This is spam" to \["myself@me\.com"\]\n"This is spam" to \["myself@me\.com"\]/
|
matcher.failure_message.should =~ /Deliveries:\n"This is spam" to \["myself@me\.com"\]\n"This is spam" to \["myself@me\.com"\]/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should chain" do
|
it "allows chaining" do
|
||||||
should have_sent_email.with_subject(/spam/).from('do-not-reply@example.com').with_body(/spam/).to('myself@me.com')
|
should have_sent_email.with_subject(/spam/).from('do-not-reply@example.com').with_body(/spam/).to('myself@me.com')
|
||||||
should_not have_sent_email.with_subject(/ham/).from('you@example.com').with_body(/ham/).to('them@example.com')
|
should_not have_sent_email.with_subject(/ham/).from('you@example.com').with_body(/ham/).to('them@example.com')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should provide a detailed description of the e-mail expected to be sent" do
|
it "provides a detailed description of the e-mail expected to be sent" do
|
||||||
matcher = have_sent_email
|
matcher = have_sent_email
|
||||||
matcher.description.should == 'send an email'
|
matcher.description.should == 'send an email'
|
||||||
matcher = matcher.with_subject("Welcome!")
|
matcher = matcher.with_subject("Welcome!")
|
||||||
|
|
Loading…
Reference in New Issue