aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/public_body_translations.yml20
-rw-r--r--spec/lib/mail_handler/mail_handler_spec.rb2
-rw-r--r--spec/lib/sendmail_return_path_spec.rb88
-rw-r--r--spec/mailers/application_mailer_spec.rb2
-rw-r--r--spec/models/xapian_spec.rb2
-rw-r--r--spec/spec_helper.rb4
6 files changed, 27 insertions, 91 deletions
diff --git a/spec/fixtures/public_body_translations.yml b/spec/fixtures/public_body_translations.yml
index 2030804ac..225bd74e2 100644
--- a/spec/fixtures/public_body_translations.yml
+++ b/spec/fixtures/public_body_translations.yml
@@ -10,6 +10,8 @@ geraldine_es_public_body_translation:
notes: ""
publication_scheme: ""
disclosure_log: ""
+ created_at: 2007-10-24 10:51:01.161639
+ updated_at: 2007-10-24 10:51:01.161639
geraldine_en_public_body_translation:
name: Geraldine Quango
@@ -23,6 +25,8 @@ geraldine_en_public_body_translation:
notes: ""
publication_scheme: ""
disclosure_log: ""
+ created_at: 2007-10-24 10:51:01.161639
+ updated_at: 2007-10-24 10:51:01.161639
humpadink_es_public_body_translation:
name: "El Department for Humpadinking"
@@ -36,6 +40,8 @@ humpadink_es_public_body_translation:
notes: Baguette
publication_scheme: ""
disclosure_log: ""
+ created_at: 2007-10-24 10:51:01.161639
+ updated_at: 2007-10-24 10:51:01.161639
humpadink_en_public_body_translation:
name: "Department for Humpadinking"
@@ -49,6 +55,8 @@ humpadink_en_public_body_translation:
notes: An albatross told me!!!
publication_scheme: ""
disclosure_log: ""
+ created_at: 2007-10-24 10:51:01.161639
+ updated_at: 2007-10-24 10:51:01.161639
forlorn_en_public_body_translation:
name: "Department of Loneliness"
@@ -62,6 +70,8 @@ forlorn_en_public_body_translation:
notes: A very lonely public body that no one has corresponded with
publication_scheme: ""
disclosure_log: ""
+ created_at: 2007-10-24 10:51:01.161639
+ updated_at: 2007-10-24 10:51:01.161639
silly_walks_en_public_body_translation:
id: 6
@@ -75,6 +85,8 @@ silly_walks_en_public_body_translation:
notes: You know the one.
publication_scheme: ""
disclosure_log: ""
+ created_at: 2007-10-24 10:51:01.161639
+ updated_at: 2007-10-24 10:51:01.161639
sensible_walks_en_public_body_translation:
id: 7
@@ -88,6 +100,8 @@ sensible_walks_en_public_body_translation:
notes: I bet you’ve never heard of it.
publication_scheme: ""
disclosure_log: ""
+ created_at: 2008-10-25 10:51:01.161639
+ updated_at: 2008-10-25 10:51:01.161639
other_public_body_translation:
id: 8
@@ -101,6 +115,8 @@ other_public_body_translation:
notes: More notes
publication_scheme: ""
disclosure_log: ""
+ created_at: 2008-10-25 10:51:01.161639
+ updated_at: 2008-10-25 10:51:01.161639
humpadink_he_IL_public_body_translation:
name: "Hebrew Humpadinking"
@@ -114,6 +130,8 @@ humpadink_he_IL_public_body_translation:
notes: An albatross told me!!!
publication_scheme: ""
disclosure_log: ""
+ created_at: 2007-10-24 10:51:01.161639
+ updated_at: 2007-10-24 10:51:01.161639
accented_public_body_translation:
id: 10
@@ -127,3 +145,5 @@ accented_public_body_translation:
notes: This is to test unicode handling in body names
publication_scheme: ""
disclosure_log: ""
+ created_at: 2008-10-25 10:51:01.161639
+ updated_at: 2008-10-25 10:51:01.161639
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb
index aa351bd94..bc027eaec 100644
--- a/spec/lib/mail_handler/mail_handler_spec.rb
+++ b/spec/lib/mail_handler/mail_handler_spec.rb
@@ -235,7 +235,7 @@ describe 'when deriving a name, email and formatted address from a message from
it 'should quote a name with quotes in it' do
should_render_from_address('"FOI \" Person" <foiperson@localhost>',
- ['FOI \" Person',
+ ['FOI " Person',
'foiperson@localhost',
'"FOI \" Person" <foiperson@localhost>'])
end
diff --git a/spec/lib/sendmail_return_path_spec.rb b/spec/lib/sendmail_return_path_spec.rb
deleted file mode 100644
index 83436c2bd..000000000
--- a/spec/lib/sendmail_return_path_spec.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-# This is a test of the monkey patches in sendmail_return_path.rb
-
-# In Rails 3 the monkeypatches are not needed anymore because sendmail now has the "-f" flag
-# set correctly. So, strictly these tests are testing the Rails internals. So, that means we really
-# should delete them. Let's do that later when things have settled down. For the time being leave
-# them in
-
-require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
-
-describe "when sending email with an altered return path" do
- before(:each) { ActionMailer::Base.deliveries = [] }
-
- it "should default to delivery method test" do
- ActionMailer::Base.delivery_method.should == :test
- end
-
- it "should let the helper change the method" do
- with_delivery_method :smtp do
- ActionMailer::Base.delivery_method.should == :smtp
- end
- ActionMailer::Base.delivery_method.should == :test
- end
-
- # Documentation for fancy mock functions: http://rspec.info/documentation/mocks/message_expectations.html
- it "should set the return path when sending email using SMTP" do
- mock_smtp = mock("smtp")
- mock_smtp_session = mock("smtp_session")
-
- mock_smtp.should_receive(:start).once.and_yield(mock_smtp_session)
- # the second parameter to the SMTP session is the sender (return path)
- mock_smtp_session.should_receive(:sendmail).once.with(anything(), "test@localhost", anything())
-
- Net::SMTP.stub!(:new).and_return(mock_smtp)
-
- with_delivery_method :smtp do
- ContactMailer.to_admin_message(
- "Mr. Test", "test@localhost", "Test script spec/lib/sendmail_return_path_spec.rb",
- "This is just a test for a test script", nil, nil, nil
- ).deliver
- end
-
- deliveries = ActionMailer::Base.deliveries
- deliveries.size.should == 0
- end
-
- it "should set the return path when sending email using sendmail" do
- with_stub_popen do
- IO.should_receive(:popen).once.with('/usr/sbin/sendmail -i -t -f "test@localhost" postmaster@localhost', "w+")
- with_delivery_method :sendmail do
- ContactMailer.to_admin_message(
- "Mr. Test", "test@localhost", "Test script spec/lib/sendmail_return_path_spec.rb",
- "This is just a test for a test script", nil, nil, nil
- ).deliver
- end
- end
-
- deliveries = ActionMailer::Base.deliveries
- deliveries.size.should == 0
- end
-
-
- protected
- # Change the way Rails delivers memory, just for current scope
- def with_delivery_method(new_delivery_method)
- old_delivery_method, ActionMailer::Base.delivery_method = ActionMailer::Base.delivery_method, new_delivery_method
- yield
- ensure
- ActionMailer::Base.delivery_method = old_delivery_method
- end
-
- # By default, we can't stub popen, presumably because it is a builtin written in C.
- # Replace it entirely with a normal method that just calls the C one, so we can stub it -
- # this leaves IO working afterwards (for other tests that run in the same instance).
- def with_stub_popen()
- IO.class_eval "@orig_popen = self.method(:popen); def self.popen(a, b, &c); @orig_popen.call(a, b, &c); end"
- begin
- yield
- ensure
- # in theory would undo the popen alterations and return IO to a pristine state, but
- # don't know how to (much fiddling with alias bind and the like didn't help). It
- # doesn't matter - the new popen should behave just the same.
- end
- end
-
-
-end
-
-
diff --git a/spec/mailers/application_mailer_spec.rb b/spec/mailers/application_mailer_spec.rb
index d8993f78f..718ac47fb 100644
--- a/spec/mailers/application_mailer_spec.rb
+++ b/spec/mailers/application_mailer_spec.rb
@@ -13,7 +13,7 @@ describe ApplicationMailer do
end
def add_mail_methods(method_names)
- method_names.each{ |method_name| ApplicationMailer.send(:define_method, method_name){} }
+ method_names.each{ |method_name| ApplicationMailer.send(:define_method, method_name){ mail() } }
end
def remove_mail_methods(method_names)
diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb
index 3c9fff784..a1e060d8e 100644
--- a/spec/models/xapian_spec.rb
+++ b/spec/models/xapian_spec.rb
@@ -370,7 +370,7 @@ describe PublicBody, " when only indexing selected things on a rebuild" do
end
end
-# I would expect ActsAsXapian to have some tests under vendor/plugins/acts_as_xapian, but
+# I would expect ActsAsXapian to have some tests under lib/acts_as_xapian, but
# it looks like this is not the case. Putting a test here instead.
describe ActsAsXapian::Search, "#words_to_highlight" do
before(:each) do
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index d22f3c0ff..1eeb8603b 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -13,6 +13,10 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov.start('rails') do
add_filter 'commonlib'
add_filter 'vendor/plugins'
+ add_filter 'lib/strip_attributes'
+ add_filter 'lib/has_tag_string'
+ add_filter 'lib/acts_as_xapian'
+ add_filter 'lib/themes'
end
Spork.prefork do