diff options
| -rw-r--r-- | app/views/referentials/show.html.slim | 2 | ||||
| -rw-r--r-- | spec/features/referentials_spec.rb | 24 | 
2 files changed, 25 insertions, 1 deletions
| diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim index 62a17ea1e..9ed63d516 100644 --- a/app/views/referentials/show.html.slim +++ b/app/views/referentials/show.html.slim @@ -3,7 +3,7 @@               @referential.name,               'Lorem ipsum dolor sit amet',               t('last_update', time: l(@referential.updated_at, format: :short)), -             link_to(t('actions.edit'), edit_referential_path(@referential), class: 'btn btn-default') do +             @referential.archived? ? nil : link_to(t('actions.edit'), edit_referential_path(@referential), class: 'btn btn-default') do    / Below is secundary actions & optional contents (filters, ...)    .row.mb-sm diff --git a/spec/features/referentials_spec.rb b/spec/features/referentials_spec.rb index 39c5adcd5..ebaf70bca 100644 --- a/spec/features/referentials_spec.rb +++ b/spec/features/referentials_spec.rb @@ -4,6 +4,8 @@ require 'spec_helper'  describe "Referentials", :type => :feature do    login_user +  let(:referential) { Referential.first } +    describe "index" do      # FIXME #823 @@ -33,6 +35,28 @@ describe "Referentials", :type => :feature do    end +  describe "show" do +    before(:each) { visit referential_path(referential) } + +    it "displays referential" do +      expect(page).to have_content(referential.name) +    end + +    context 'archived referential' do +      it 'link to edit referetnial is not displayed' do +        referential.archive! +        visit referential_path(referential) +        expect(page).not_to have_link(I18n.t('actions.edit'), href: edit_referential_path(referential)) +      end +    end + +    context 'unarchived referential' do +      it 'link to edit referetnial is displayed' do +        expect(page).to have_link(I18n.t('actions.edit'), href: edit_referential_path(referential)) +      end +    end +  end +    describe "create" do      it "should" do | 
