Sha256: 0f1d659a65700e16394c7f8fe07b522f81ccffa2cf1a9bac26276c89aef9c495

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

require File.expand_path('../test_helper', File.dirname(__FILE__))

class GalleryTest < ActiveSupport::TestCase
  
  def test_fixtures_validity
    Sofa::Gallery.all.each do |gallery|
      assert gallery.valid?, gallery.errors.full_messages.to_s
    end
  end
  
  def test_validations
    gallery = Sofa::Gallery.new
    assert gallery.invalid?
    assert_has_errors_on gallery, [:title, :slug]
  end
  
  def test_creation
    assert_difference 'Sofa::Gallery.count' do
      Sofa::Gallery.create!(
        :title  => 'Test Gallery',
        :slug   => 'test-gallery'
      )
    end
  end
  
  def test_destoy
    gallery = sofa_galleries(:default)
    assert_difference ['Sofa::Gallery.count', 'Sofa::Photo.count'], -1 do
      gallery.destroy
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sofa_gallery-0.0.0 test/unit/gallery_test.rb