aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/referentials_controller_spec.rb
blob: a3be0dbd1860dc88d3fe0f96499944f780722393 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
describe ReferentialsController, :type => :controller do

  login_user

  let(:referential) { Referential.first }
  let(:organisation) { create :organisation }
  let(:other_referential) { create :referential, organisation: organisation }

  describe 'PUT archive' do
    context "user's organisation matches referential's organisation" do
      it 'returns http success' do
        put :archive, id: referential.id
        expect(response).to have_http_status(302)
      end
    end

    context "user's organisation doesn't match referential's organisation" do
      pending "hotfix opens all unknow actions need to close the uneeded later" do
      #it 'raises a ActiveRecord::RecordNotFound' do
        expect { put :archive, id: other_referential.id }.to raise_error(ActiveRecord::RecordNotFound)
      end
    end
  end

end