Sha256: 97eadb7284957663af8718b6d1538383a60e00c5f155681d024065c4190e97c1

Contents?: true

Size: 884 Bytes

Versions: 2

Compression:

Stored size: 884 Bytes

Contents

require 'spec_helper'

describe Flms::LayersController do
  include NamedFactories

  describe 'delete' do
    describe 'access control' do
      let(:request) { delete :destroy, id: image_layer_1a1.id, block_id: block_1a.id, use_route: :flms }
      let(:access_granted_check) { response.status == 302 && response.location == "http://test.host/flms/blocks/#{block_1a.id}/edit" }
      let(:database_performed_check) { Flms::Layer.count == 0 }
      it_should_behave_like 'an action accessible only to logged-in users'
    end

    describe 'functionality' do

      it 'deletes the given image layer' do
        sign_in user
        delete :destroy, id: image_layer_1a1.id, block_id: block_1a.id, use_route: :flms

        expect(response).to redirect_to "http://test.host/flms/blocks/#{block_1a.id}/edit"
        expect(Flms::Layer).to have(0).instances
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flms-0.9.0 spec/controllers/layers_controller_spec.rb
flms-0.1.0 spec/controllers/layers_controller_spec.rb