aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/models/public_body_spec.rb22
-rw-r--r--spec/views/public_body/show.html.erb_spec.rb21
2 files changed, 33 insertions, 10 deletions
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index c18de3013..7d48fa169 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -893,6 +893,28 @@ describe PublicBody do
@body.has_request_email?.should == true
end
end
+
+ describe :special_not_requestable_reason do
+
+ before do
+ @body = PublicBody.new
+ end
+
+ it 'should return true if the body is defunct' do
+ @body.stub!(:defunct?).and_return(true)
+ @body.special_not_requestable_reason?.should == true
+ end
+
+ it 'should return true if FOI does not apply' do
+ @body.stub!(:not_apply?).and_return(true)
+ @body.special_not_requestable_reason?.should == true
+ end
+
+ it 'should return false if the body is not defunct and FOI applies' do
+ @body.special_not_requestable_reason?.should == false
+ end
+ end
+
end
describe PublicBody, " when override all public body request emails set" do
diff --git a/spec/views/public_body/show.html.erb_spec.rb b/spec/views/public_body/show.html.erb_spec.rb
index 0559fc8ef..917c0c793 100644
--- a/spec/views/public_body/show.html.erb_spec.rb
+++ b/spec/views/public_body/show.html.erb_spec.rb
@@ -2,10 +2,10 @@ require File.expand_path(File.join('..', '..', '..', 'spec_helper'), __FILE__)
describe "public_body/show" do
before do
- @pb = mock_model(PublicBody,
- :name => 'Test Quango',
+ @pb = mock_model(PublicBody,
+ :name => 'Test Quango',
:short_name => 'tq',
- :url_name => 'testquango',
+ :url_name => 'testquango',
:notes => '',
:type_of_authority => 'A public body',
:eir_only? => nil,
@@ -15,6 +15,7 @@ describe "public_body/show" do
: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)
@pb.stub!(:has_tag?).and_return(false)
@xap = mock(ActsAsXapian::Search, :matches_estimated => 2)
@@ -69,7 +70,7 @@ describe "public_body/show" do
response.should have_selector("div#header_right") do
have_selector "a", :href => /www.charity-commission.gov.uk.*RegisteredCharityNumber=12345$/
end
- end
+ end
it "should link to Scottish Charity Regulator site if we have an SC number" do
@pb.stub!(:has_tag?).and_return(true)
@@ -79,7 +80,7 @@ describe "public_body/show" do
response.should have_selector("div#header_right") do
have_selector "a", :href => /www.oscr.org.uk.*id=SC1234$/
end
- end
+ end
it "should not link to Charity Commission site if we don't have number" do
@@ -87,15 +88,15 @@ describe "public_body/show" do
response.should have_selector("div#header_right") do
have_selector "a", :href => /charity-commission.gov.uk/
end
- end
+ end
end
-def mock_event
- return mock_model(InfoRequestEvent,
- :info_request => mock_model(InfoRequest,
- :title => 'Title',
+def mock_event
+ return mock_model(InfoRequestEvent,
+ :info_request => mock_model(InfoRequest,
+ :title => 'Title',
:url_title => 'title',
:display_status => 'waiting_response',
:calculate_status => 'waiting_response',