Sha256: 9a0597095799ee51fba48c37a4ca57f802ec6abb5cb379b7f64924c52a2f914b

Contents?: true

Size: 884 Bytes

Versions: 7

Compression:

Stored size: 884 Bytes

Contents

require 'spec_helper'

describe Kuhsaft::ImageSize, type: :model do
  before do
    Kuhsaft::ImageSize.build_defaults!
  end

  describe '.build_defaults!' do
    it 'sets the default sizes' do
      expect(Kuhsaft::ImageSize.all).to eq([Kuhsaft::ImageSize.gallery_size,
                                            Kuhsaft::ImageSize.teaser_size])
    end
  end

  describe '.clear!' do
    before do
      Kuhsaft::ImageSize.clear!
    end

    it 'empties the list' do
      expect(Kuhsaft::ImageSize.all).to be_empty
    end
  end

  describe '.add' do
    it 'adds a new image size' do
      expect { Kuhsaft::ImageSize.add(:stuff, 200, 100) }.to change(Kuhsaft::ImageSize.all, :count).by(1)
    end
  end

  describe '.find_by_name' do
    it 'returns the size' do
      expect(Kuhsaft::ImageSize.find_by_name('gallery')).to eq(Kuhsaft::ImageSize.gallery_size)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kuhsaft-2.6.3 spec/models/image_size_spec.rb
kuhsaft-2.6.2 spec/models/image_size_spec.rb
kuhsaft-2.6.1 spec/models/image_size_spec.rb
kuhsaft-2.5.2 spec/models/image_size_spec.rb
kuhsaft-2.6.0 spec/models/image_size_spec.rb
kuhsaft-2.5.1 spec/models/image_size_spec.rb
kuhsaft-2.5.0 spec/models/image_size_spec.rb