Sha256: b5f03572eb922bac197d412b96e98b61ffc6becd150af8394c51ff9f380bdf79

Contents?: true

Size: 753 Bytes

Versions: 8

Compression:

Stored size: 753 Bytes

Contents

describe Symphonia::AttachmentsController, logged: true do

  let!(:file) { FactoryBot.create(:file) }
  let(:images) { FactoryBot.create_list(:image, 3, attachable_id: nil, attachable_type: nil) }

  it '#show' do
    get symphonia.attachment_path(file)
    expect(response.body).to match file.attachment.url(:original)
  end

  it '#destroy' do
    expect{ delete(symphonia.attachment_path(file)) }.to change(Symphonia::Attachment, :count).by -1
  end

  it '#reorder' do
    expect { images }.to change(Symphonia::Image, :count).by 3
    patch symphonia.reorder_attachment_path images.last, 1
    expect(response).to have_http_status :success
    imgs = Symphonia::Image.order(:position).to_a
    expect(imgs.first.id).to be > imgs.last.id
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
symphonia-3.1.0 spec/requests/attachments_controller_spec.rb
symphonia-3.0.3 spec/requests/attachments_controller_spec.rb
symphonia-3.0.2 spec/requests/attachments_controller_spec.rb
symphonia-2.2.1 spec/requests/attachments_controller_spec.rb
symphonia-3.0.1 spec/requests/attachments_controller_spec.rb
symphonia-3.0.0 spec/requests/attachments_controller_spec.rb
symphonia-2.1.8 spec/requests/attachments_controller_spec.rb
symphonia-2.1.7 spec/requests/attachments_controller_spec.rb