Sha256: 13d823255a2469bd285881954fbb9fefd000c655a3cd9713192cca576030b632

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'test_helper'

class ImageTest < ActiveSupport::TestCase
  test "image can be associated with people" do
    image = kinney_images(:tolson1)
    image.people << kinney_people(:williams)
    assert image.valid?
  end
  
  test "image must have a filename" do
    assert Kinney::Image.new(:filename => 'filename').valid?
    assert_false Kinney::Image.new(:filename => nil).valid?
  end
  
  test "image filename must be unique" do
    assert_false Kinney::Image.new(:filename => kinney_images(:tolson1).filename).valid?
  end

  test "give a URL as the external_url" do
    assert_equal "http://d.lib.ncsu.edu/collections/catalog/si-ag1962-p100-tolson", kinney_images(:tolson1).external_url
  end

  test "should return a top pick image if a person has a top pick image" do    
    assert kinney_people(:tolson).image
  end

  test "should return an image of the person has at least one image even if it is not selected as a top_pick image" do
    person = kinney_people(:third_man)
    person.images = [kinney_images(:tolson1)]
    person.save
    assert person.image
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kinney-0.0.3 test/unit/image_test.rb
kinney-0.0.2 test/unit/image_test.rb
kinney-0.0.1 test/unit/image_test.rb