aboutsummaryrefslogtreecommitdiffstats
path: root/spec/helpers
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2015-04-14 15:29:37 +0100
committerLouise Crow <louise.crow@gmail.com>2015-04-28 09:07:25 +0100
commitca66d9b22bca71f4c0a62121e6bff7c7da93d20d (patch)
treeec4970007438cc240ec0ce248780eb8c911e28da /spec/helpers
parentf77d5f9f70f4a0755a9772436357fc315124e92c (diff)
Use a helper to generate the status text.
This has length constraints, so we don't want to directly use InfoRequest.get_status_description (which also adds a full stop), but we want statuses that more closely correspond to get_status_description than those in the template, which are used in AskTheEU.
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/widget_helper_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/helpers/widget_helper_spec.rb b/spec/helpers/widget_helper_spec.rb
new file mode 100644
index 000000000..b0da20c39
--- /dev/null
+++ b/spec/helpers/widget_helper_spec.rb
@@ -0,0 +1,31 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe WidgetHelper do
+
+ include WidgetHelper
+
+ describe :status_description do
+
+ before do
+ @info_request = FactoryGirl.build(:info_request)
+ end
+
+ it 'should return "Awaiting classification" for "waiting_classification' do
+ @info_request.stub!(:calculate_status).and_return("waiting_classification")
+ expect(status_description(@info_request)).to eq('Awaiting classification')
+ end
+
+ it 'should call theme_display_status for a theme status' do
+ @info_request.stub!(:calculate_status).and_return("special_status")
+ @info_request.stub!(:theme_display_status).and_return("Special status")
+ expect(status_description(@info_request)).to eq('Special status')
+ end
+
+ it 'should return unknown for an unknown status' do
+ @info_request.stub!(:calculate_status).and_return("special_status")
+ expect(status_description(@info_request)).to eq('Unknown')
+ end
+
+ end
+
+end \ No newline at end of file