From d2978c46561c03299846ce121a4f7e730c32077f Mon Sep 17 00:00:00 2001 From: Tanguy PATTE Date: Tue, 15 Dec 2015 16:49:48 +0100 Subject: [PATCH] add api token in administrator's profile page --- app/controllers/admin/profile_controller.rb | 4 ++-- app/views/admin/profile/show.html.haml | 7 ++++++- spec/controllers/admin/profile_controller_spec.rb | 5 +++++ spec/views/admin/profile/show.html.haml_spec.rb | 11 +++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 spec/controllers/admin/profile_controller_spec.rb create mode 100644 spec/views/admin/profile/show.html.haml_spec.rb diff --git a/app/controllers/admin/profile_controller.rb b/app/controllers/admin/profile_controller.rb index 8e4e218e9..7da74af64 100644 --- a/app/controllers/admin/profile_controller.rb +++ b/app/controllers/admin/profile_controller.rb @@ -1,5 +1,5 @@ -class Admin::ProfileController < ApplicationController +class Admin::ProfileController < AdminController def show - + @administrateur = current_administrateur end end diff --git a/app/views/admin/profile/show.html.haml b/app/views/admin/profile/show.html.haml index 5cbe3cd10..5349fd071 100644 --- a/app/views/admin/profile/show.html.haml +++ b/app/views/admin/profile/show.html.haml @@ -1 +1,6 @@ -#profile_page \ No newline at end of file +#profile_page +%h2 Profile +%hr +%p + API TOKEN : + = @administrateur.api_token \ No newline at end of file diff --git a/spec/controllers/admin/profile_controller_spec.rb b/spec/controllers/admin/profile_controller_spec.rb new file mode 100644 index 000000000..556c04316 --- /dev/null +++ b/spec/controllers/admin/profile_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Admin::ProfileController, type: :controller do + it { expect(described_class).to be < AdminController } +end \ No newline at end of file diff --git a/spec/views/admin/profile/show.html.haml_spec.rb b/spec/views/admin/profile/show.html.haml_spec.rb new file mode 100644 index 000000000..631cc3d92 --- /dev/null +++ b/spec/views/admin/profile/show.html.haml_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe 'admin/profile/show.html.haml', type: :view do + let(:token) { 'super_token' } + let(:admin) { create(:administrateur, api_token: token) } + before do + assign(:administrateur, admin) + render + end + it { expect(rendered).to have_content(token) } +end \ No newline at end of file