Skip to content

Commit

Permalink
Merge pull request #327 from codeforamerica/show-version-number-in-ad…
Browse files Browse the repository at this point in the history
…min-interface

Display Ohana API version for super admins.
  • Loading branch information
monfresh committed Apr 27, 2015
2 parents 695932b + e239dc2 commit 4558ca5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
module ApplicationHelper
def version
@version ||= File.read('VERSION')
end
end
3 changes: 2 additions & 1 deletion app/views/admin/dashboard/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@
%p= link_to 'Download all regular schedules as CSV', admin_csv_regular_schedules_path, class: 'btn btn-primary'
%p= link_to 'Download all services as CSV', admin_csv_services_path, class: 'btn btn-primary'


%hr
Ohana API #{link_to "v#{version}", 'https://github.com/codeforamerica/ohana-api/blob/master/CHANGELOG.md'}
25 changes: 25 additions & 0 deletions spec/features/admin/dashboard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,29 @@
to have_link('Download all services as CSV', admin_csv_services_path)
end
end

describe 'Ohana API version' do
before do
allow(File).to receive(:read).with('VERSION').and_return('1.0.0')
end
let(:prefix) { 'https://github.com/codeforamerica/ohana-api/blob/master/' }

context 'super admin' do
it 'displays Ohana API version number' do
login_super_admin
visit '/admin'

expect(page).to have_link 'v1.0.0', href: "#{prefix}CHANGELOG.md"
end
end

context 'regular admin' do
it 'does not display Ohana API version number' do
login_admin
visit '/admin'

expect(page).to_not have_link 'v1.0.0', href: "#{prefix}CHANGELOG.md"
end
end
end
end

0 comments on commit 4558ca5

Please sign in to comment.