aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/general_controller_spec.rb1
-rw-r--r--spec/integration/xapian_search_highlighting_spec.rb11
-rw-r--r--spec/models/info_request_spec.rb1
-rw-r--r--spec/models/public_body_spec.rb27
-rw-r--r--spec/views/public_body/show.html.erb_spec.rb1
5 files changed, 39 insertions, 2 deletions
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index ae8d4f256..844fcd4e6 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -169,7 +169,6 @@ describe GeneralController, "when showing the frontpage" do
it 'should end a logged-in session whose ttl has expired' do
session[:ttl] = Time.now - 4.hours
get :frontpage
- response.should redirect_to signin_path
session[:user_id].should be_nil
end
diff --git a/spec/integration/xapian_search_highlighting_spec.rb b/spec/integration/xapian_search_highlighting_spec.rb
index b2994eb31..a91df341f 100644
--- a/spec/integration/xapian_search_highlighting_spec.rb
+++ b/spec/integration/xapian_search_highlighting_spec.rb
@@ -1,3 +1,5 @@
+# encoding: utf-8
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe 'highlighting search results' do
@@ -40,4 +42,13 @@ describe 'highlighting search results' do
highlight_matches(phrase, matches).should == '<mark>boring</mark>'
end
+ it 'handles macrons correctly' do
+ phrase = 'Māori'
+
+ search = ActsAsXapian::Search.new([PublicBody], phrase, :limit => 1)
+ matches = search.words_to_highlight(:regex => true, :include_original => true)
+
+ highlight_matches(phrase, matches).should == '<mark>Māori</mark>'
+ end
+
end
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index c8bd2c338..d8c0c59b1 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -1221,6 +1221,7 @@ describe InfoRequest do
describe InfoRequest, "when constructing a list of requests by query" do
before(:each) do
+ load_raw_emails_data
get_fixtures_xapian_index
end
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index 7b55efda1..cce017424 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -1237,6 +1237,33 @@ describe PublicBody do
end
+ describe :request_email do
+ context "when the email is set" do
+ subject(:public_body) { FactoryGirl.create(:public_body, :request_email => "request@example.com") }
+
+ it "should return the set email address" do
+ expect(public_body.request_email).to eq("request@example.com")
+ end
+
+ it "should return a different email address when overridden in configuration" do
+ AlaveteliConfiguration.stub!(:override_all_public_body_request_emails).and_return("tester@example.com")
+ expect(public_body.request_email).to eq("tester@example.com")
+ end
+ end
+
+ context "when no email is set" do
+ subject(:public_body) { FactoryGirl.create(:public_body, :request_email => "") }
+
+ it "should return a blank email address" do
+ expect(public_body.request_email).to be_blank
+ end
+
+ it "should still return a blank email address when overridden in configuration" do
+ AlaveteliConfiguration.stub!(:override_all_public_body_request_emails).and_return("tester@example.com")
+ expect(public_body.request_email).to be_blank
+ end
+ end
+ end
end
describe PublicBody::Translation do
diff --git a/spec/views/public_body/show.html.erb_spec.rb b/spec/views/public_body/show.html.erb_spec.rb
index 6ebc39caa..2a4c21d04 100644
--- a/spec/views/public_body/show.html.erb_spec.rb
+++ b/spec/views/public_body/show.html.erb_spec.rb
@@ -13,7 +13,6 @@ describe "public_body/show" do
:publication_scheme => '',
:disclosure_log => '',
:calculated_home_page => '')
- @pb.stub!(:override_request_email).and_return(nil)
@pb.stub!(:is_requestable?).and_return(true)
@pb.stub!(:special_not_requestable_reason?).and_return(false)
@pb.stub!(:has_notes?).and_return(false)