aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2012-09-12 17:54:01 +0100
committerLouise Crow <louise.crow@gmail.com>2012-09-12 17:54:01 +0100
commit77a22824fb23bc25945adf2b96feb55b004bdb8a (patch)
tree5962b090ca4a705386876352f4d316dcf2a31131 /spec/models
parent98fe4eab026e3fe2545bffaa8f14a128ba407d62 (diff)
Memoize the notes_without_html calculated value for the life of the model instance - no need to keep applying the regex if called multiple times e.g. in a view.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/public_body_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index 9e22a9c43..011824190 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -407,6 +407,7 @@ describe PublicBody, " when loading CSV files" do
end
describe PublicBody do
+
describe "calculated home page" do
it "should return the home page verbatim if it's present" do
public_body = PublicBody.new
@@ -438,4 +439,17 @@ describe PublicBody do
public_body.calculated_home_page.should == "https://example.com"
end
end
+
+ describe 'when asked for notes without html' do
+
+ before do
+ @public_body = PublicBody.new(:notes => 'some <a href="/notes">notes</a>')
+ end
+
+ it 'should remove simple tags from notes' do
+ @public_body.notes_without_html.should == 'some notes'
+ end
+
+ end
+
end