Skip to content

Commit df28faf

Browse files
Tweak to application helper, with test
1 parent 9c886fa commit df28faf

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

app/helpers/application_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module ApplicationHelper
22
def tacos_enabled?
3-
ENV.fetch('TACOS_URL', false)
3+
ENV.fetch('TACOS_URL', '').length > 0
44
end
55
module_function :tacos_enabled?
66

test/helpers/application_helper_test.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
class ApplicationHelperTest < ActionView::TestCase
44
include ApplicationHelper
55

6+
test 'tacos_enabled? requires TACOS_URL env variable to have non-zero length' do
7+
ClimateControl.modify TACOS_URL: 'foo' do
8+
assert_equal true, tacos_enabled?
9+
end
10+
11+
ClimateControl.modify TACOS_URL: '' do
12+
assert_equal false, tacos_enabled?
13+
end
14+
end
15+
616
test 'index_page_title renders as expected' do
717
assert_equal 'Search | MIT Libraries', index_page_title
818
end

0 commit comments

Comments
 (0)