aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/general_controller_spec.rb8
-rw-r--r--spec/controllers/services_controller_spec.rb8
-rw-r--r--spec/controllers/user_controller_spec.rb2
-rw-r--r--spec/helpers/link_to_helper_spec.rb2
-rw-r--r--spec/integration/admin_spec.rb2
-rw-r--r--spec/mailers/request_mailer_spec.rb10
-rw-r--r--spec/models/incoming_message_spec.rb2
-rw-r--r--spec/models/mail_server_log_spec.rb10
-rw-r--r--spec/spec_helper.rb4
-rw-r--r--spec/support/validate_html.rb2
10 files changed, 25 insertions, 25 deletions
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index d4aa034a7..9a88dbc3a 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -20,13 +20,13 @@ end
describe GeneralController, 'when getting the blog feed' do
it 'should add a lang param correctly to a url with no querystring' do
- Configuration.stub!(:blog_feed).and_return("http://blog.example.com")
+ AlaveteliConfiguration.stub!(:blog_feed).and_return("http://blog.example.com")
get :blog
assigns[:feed_url].should == "http://blog.example.com?lang=en"
end
it 'should add a lang param correctly to a url with an existing querystring' do
- Configuration.stub!(:blog_feed).and_return("http://blog.example.com?alt=rss")
+ AlaveteliConfiguration.stub!(:blog_feed).and_return("http://blog.example.com?alt=rss")
get :blog
assigns[:feed_url].should == "http://blog.example.com?alt=rss&lang=en"
end
@@ -104,11 +104,11 @@ describe GeneralController, "when showing the frontpage" do
before do
@default_lang_home_link = /href=".*\/en\//
@other_lang_home_link = /href=".*\/es\//
- @old_include_default_locale_in_urls = Configuration::include_default_locale_in_urls
+ @old_include_default_locale_in_urls = AlaveteliConfiguration::include_default_locale_in_urls
end
def set_default_locale_in_urls(value)
- Configuration.stub!(:include_default_locale_in_urls).and_return(value)
+ AlaveteliConfiguration.stub!(:include_default_locale_in_urls).and_return(value)
load Rails.root.join("config/initializers/fast_gettext.rb")
end
diff --git a/spec/controllers/services_controller_spec.rb b/spec/controllers/services_controller_spec.rb
index 796c6b63d..399f48acb 100644
--- a/spec/controllers/services_controller_spec.rb
+++ b/spec/controllers/services_controller_spec.rb
@@ -54,27 +54,27 @@ describe ServicesController, "when returning a message for people in other count
it "should return the 'another country' message if the service responds OK" do
config = MySociety::Config.load_default()
config['ISO_COUNTRY_CODE'] = "DE"
- Configuration.stub!(:gaze_url).and_return('http://denmark.com')
+ AlaveteliConfiguration.stub!(:gaze_url).and_return('http://denmark.com')
FakeWeb.register_uri(:get, %r|denmark.com|, :body => "DK")
get :other_country_message
response.should be_success
response.body.should == 'Hello! We have an <a href="/help/alaveteli?country_name=Deutschland">important message</a> for visitors outside Deutschland <span class="close-button">X</span>'
end
it "should default to no message if the country_from_ip domain doesn't exist" do
- Configuration.stub!(:gaze_url).and_return('http://12123sdf14qsd.com')
+ AlaveteliConfiguration.stub!(:gaze_url).and_return('http://12123sdf14qsd.com')
get :other_country_message
response.should be_success
response.body.should == ''
end
it "should default to no message if the country_from_ip service doesn't exist" do
- Configuration.stub!(:gaze_url).and_return('http://www.google.com')
+ AlaveteliConfiguration.stub!(:gaze_url).and_return('http://www.google.com')
get :other_country_message
response.should be_success
response.body.should == ''
end
it "should default to no message if the country_from_ip service returns an error" do
FakeWeb.register_uri(:get, %r|500.com|, :body => "Error", :status => ["500", "Error"])
- Configuration.stub!(:gaze_url).and_return('http://500.com')
+ AlaveteliConfiguration.stub!(:gaze_url).and_return('http://500.com')
get :other_country_message
response.should be_success
response.body.should == ''
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index 0825d12bf..6cd1c099f 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -332,7 +332,7 @@ describe UserController, "when sending another user a message" do
deliveries = ActionMailer::Base.deliveries
deliveries.size.should == 1
mail = deliveries[0]
- mail.body.should include("Bob Smith has used #{Configuration::site_name} to send you the message below")
+ mail.body.should include("Bob Smith has used #{AlaveteliConfiguration::site_name} to send you the message below")
mail.body.should include("Just a test!")
#mail.to_addrs.first.to_s.should == users(:silly_name_user).name_and_email # XXX fix some nastiness with quoting name_and_email
mail.from_addrs.first.to_s.should == users(:bob_smith_user).email
diff --git a/spec/helpers/link_to_helper_spec.rb b/spec/helpers/link_to_helper_spec.rb
index f525c9819..63daf1a75 100644
--- a/spec/helpers/link_to_helper_spec.rb
+++ b/spec/helpers/link_to_helper_spec.rb
@@ -60,7 +60,7 @@ describe LinkToHelper do
context 'with ADMIN_BASE_URL set' do
before(:each) do
- Configuration::should_receive(:admin_base_url).and_return('https://www.example.com/secure/alaveteli-admin/')
+ AlaveteliConfiguration::should_receive(:admin_base_url).and_return('https://www.example.com/secure/alaveteli-admin/')
end
it 'should prepend the admin base URL to a simple string' do
diff --git a/spec/integration/admin_spec.rb b/spec/integration/admin_spec.rb
index e148ea3ca..8a5e59ba2 100644
--- a/spec/integration/admin_spec.rb
+++ b/spec/integration/admin_spec.rb
@@ -13,7 +13,7 @@ describe "When administering the site" do
# Now fetch the "log in as" link to log in as Bob
get_via_redirect "/admin/user/login_as/#{users(:bob_smith_user).id}", nil, {
- "Authorization" => "Basic " + Base64.encode64("#{Configuration::admin_username}:#{Configuration::admin_password}").strip
+ "Authorization" => "Basic " + Base64.encode64("#{AlaveteliConfiguration::admin_username}:#{AlaveteliConfiguration::admin_password}").strip
}
response.should be_success
session[:user_id].should == users(:bob_smith_user).id
diff --git a/spec/mailers/request_mailer_spec.rb b/spec/mailers/request_mailer_spec.rb
index 18b925b33..9597045eb 100644
--- a/spec/mailers/request_mailer_spec.rb
+++ b/spec/mailers/request_mailer_spec.rb
@@ -33,7 +33,7 @@ describe RequestMailer, " when receiving incoming mail" do
deliveries = ActionMailer::Base.deliveries
deliveries.size.should == 1
mail = deliveries[0]
- mail.to.should == [ Configuration::contact_email ]
+ mail.to.should == [ AlaveteliConfiguration::contact_email ]
deliveries.clear
end
@@ -53,7 +53,7 @@ describe RequestMailer, " when receiving incoming mail" do
deliveries = ActionMailer::Base.deliveries
deliveries.size.should == 1
mail = deliveries[0]
- mail.to.should == [ Configuration::contact_email ]
+ mail.to.should == [ AlaveteliConfiguration::contact_email ]
deliveries.clear
end
@@ -73,7 +73,7 @@ describe RequestMailer, " when receiving incoming mail" do
deliveries = ActionMailer::Base.deliveries
deliveries.size.should == 1
mail = deliveries[0]
- mail.to.should == [ Configuration::contact_email ]
+ mail.to.should == [ AlaveteliConfiguration::contact_email ]
deliveries.clear
end
@@ -159,7 +159,7 @@ describe RequestMailer, " when receiving incoming mail" do
deliveries = ActionMailer::Base.deliveries
deliveries.size.should == 1
mail = deliveries[0]
- mail.to.should == [ Configuration::contact_email ]
+ mail.to.should == [ AlaveteliConfiguration::contact_email ]
deliveries.clear
end
@@ -349,7 +349,7 @@ describe RequestMailer, 'requires_admin' do
context 'has an ADMIN_BASE_URL set' do
before(:each) do
- Configuration::should_receive(:admin_base_url).and_return('http://our.proxy.server/admin/alaveteli/')
+ AlaveteliConfiguration::should_receive(:admin_base_url).and_return('http://our.proxy.server/admin/alaveteli/')
end
it 'body should contain the full admin URL' do
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb
index 781212841..aa7826865 100644
--- a/spec/models/incoming_message_spec.rb
+++ b/spec/models/incoming_message_spec.rb
@@ -353,7 +353,7 @@ describe IncomingMessage, " when censoring data" do
end
it "should apply hard-coded privacy rules to HTML files" do
- data = "http://#{Configuration::domain}/c/cheese"
+ data = "http://#{AlaveteliConfiguration::domain}/c/cheese"
@im.html_mask_stuff!(data)
data.should == "[WDTK login link]"
end
diff --git a/spec/models/mail_server_log_spec.rb b/spec/models/mail_server_log_spec.rb
index d0a1d202f..2b44a4559 100644
--- a/spec/models/mail_server_log_spec.rb
+++ b/spec/models/mail_server_log_spec.rb
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe MailServerLog do
describe ".load_file" do
before :each do
- Configuration.stub!(:incoming_email_domain).and_return("example.com")
+ AlaveteliConfiguration.stub!(:incoming_email_domain).and_return("example.com")
File.stub_chain(:stat, :mtime).and_return(DateTime.new(2012, 10, 10))
end
@@ -64,8 +64,8 @@ describe MailServerLog do
describe ".email_addresses_on_line" do
before :each do
- Configuration.stub!(:incoming_email_domain).and_return("example.com")
- Configuration.stub!(:incoming_email_prefix).and_return("foi+")
+ AlaveteliConfiguration.stub!(:incoming_email_domain).and_return("example.com")
+ AlaveteliConfiguration.stub!(:incoming_email_prefix).and_return("foi+")
end
it "recognises a single incoming email" do
@@ -106,7 +106,7 @@ describe MailServerLog do
# Postfix logs for a single email go over multiple lines. They are all tied together with the Queue ID.
# See http://onlamp.com/onlamp/2004/01/22/postfix.html
it "loads the postfix log and untangles seperate email transactions using the queue ID" do
- Configuration.stub!(:incoming_email_domain).and_return("example.com")
+ AlaveteliConfiguration.stub!(:incoming_email_domain).and_return("example.com")
log.stub!(:rewind)
ir1 = info_requests(:fancy_dog_request)
ir2 = info_requests(:naughty_chicken_request)
@@ -135,7 +135,7 @@ describe MailServerLog do
describe ".scan_for_postfix_queue_ids" do
it "returns the queue ids of interest with the connected email addresses" do
- Configuration.stub!(:incoming_email_domain).and_return("example.com")
+ AlaveteliConfiguration.stub!(:incoming_email_domain).and_return("example.com")
MailServerLog.scan_for_postfix_queue_ids(log).should == {
"CB55836EE58C" => ["request-14-e0e09f97@example.com"],
"9634B16F7F7" => ["request-10-1234@example.com"]
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index eaf77a909..3b59d05c5 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -134,8 +134,8 @@ Spork.prefork do
end
def basic_auth_login(request, username = nil, password = nil)
- username = Configuration::admin_username if username.nil?
- password = Configuration::admin_password if password.nil?
+ username = AlaveteliConfiguration::admin_username if username.nil?
+ password = AlaveteliConfiguration::admin_password if password.nil?
request.env["HTTP_AUTHORIZATION"] = "Basic " + Base64::encode64("#{username}:#{password}")
end
end
diff --git a/spec/support/validate_html.rb b/spec/support/validate_html.rb
index 56f384537..403865c74 100644
--- a/spec/support/validate_html.rb
+++ b/spec/support/validate_html.rb
@@ -20,7 +20,7 @@ end
# Monkeypatch! Validate HTML in tests.
$html_validation_script_found = false
-Configuration::utility_search_path.each do |d|
+AlaveteliConfiguration::utility_search_path.each do |d|
$html_validation_script = File.join(d, "validate")
$html_validation_script_options = ["--charset=utf-8"]
if File.file? $html_validation_script and File.executable? $html_validation_script