From 17eacaec0dcf154f8d4a11af6b83d0d3bcfbb68e Mon Sep 17 00:00:00 2001 From: shlok007 Date: Tue, 25 Jul 2017 08:16:44 +0530 Subject: [PATCH] add tests for organization name in conference views remove tests for organization name in conference#edit --- app/views/admin/conferences/show.html.haml | 2 +- app/views/layouts/_navigation.html.haml | 4 ++-- app/views/layouts/application.html.haml | 2 +- spec/features/conference_spec.rb | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/admin/conferences/show.html.haml b/app/views/admin/conferences/show.html.haml index f270867b..cddae4c2 100644 --- a/app/views/admin/conferences/show.html.haml +++ b/app/views/admin/conferences/show.html.haml @@ -1,6 +1,6 @@ %h1 %span.fa.fa-tachometer - Dashboard for #{@conference.title} ( by #{@conference.organization.name} ) + Dashboard for #{@conference.title} %hr .row .col-sm-4.col-xs-4 diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index 92be2e89..dbbfdbc0 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -7,10 +7,10 @@ %span.icon-bar %span.icon-bar %span.icon-bar - - if @conference.nil? || @conference.new_record? + - if conference.nil? || conference.new_record? = link_to (ENV['OSEM_NAME'] || 'OSEM'), root_path, class: 'navbar-brand', title: 'Open Source Event Manager' - else - = link_to (ENV['OSEM_NAME'] || "#{@conference.organization.name} Organization"), organizations_path, class: 'navbar-brand', title: 'Open Source Event Manager' + = link_to (ENV['OSEM_NAME'] || "#{conference.organization.name} Organization"), organizations_path, class: 'navbar-brand', title: 'Open Source Event Manager' .collapse.navbar-collapse - if content_for :splash_nav %ul.nav.navbar-nav#splash-nav diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 09be2523..c1a6ce78 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -21,7 +21,7 @@ = yield(:head) %body - = render 'layouts/navigation' + = render 'layouts/navigation', conference: @conference -# Admin area - if controller.class.name.split("::").first=="Admin" = render 'layouts/admin' diff --git a/spec/features/conference_spec.rb b/spec/features/conference_spec.rb index 5b9f9c54..5ac9f29b 100644 --- a/spec/features/conference_spec.rb +++ b/spec/features/conference_spec.rb @@ -73,11 +73,11 @@ feature Conference do describe 'admin' do let!(:conference) { create(:conference) } - scenario 'has organization name in edit form', feature: true, js: true do + scenario 'has organization name in menu bar for conference views', feature: true, js: true do sign_in user - visit edit_admin_conference_path(conference.short_title) - org_id = find('#conference_organization_id').value - expect(Organization.find(org_id)).to eq conference.organization + visit admin_conference_path(conference.short_title) + + expect(find('.navbar-brand').text).to eq "#{conference.organization.name} Organization" end it_behaves_like 'add and update conference'