Sha256: 11cab8fa8458305a425d06911176142d97d4f9a05abc5183d81dbe20fd1598b0
Contents?: true
Size: 1.83 KB
Versions: 2
Compression:
Stored size: 1.83 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../test_helper') class AlbumCellTest < ActiveSupport::TestCase def setup super @album = Album.first @first_photo = @album.photos(:conditions => "published_at IS NOT NULL").first @second_photo = Photo.find(@album.photos.second.id, :conditions => "published_at IS NOT NULL") @controller = CellTestController.new @cell = AlbumCell.new(@controller) end test "#single sets the album from options[:section] if available" do @cell.instance_variable_set(:@opts, {:section => @album.id}) @cell.single @cell.instance_variable_get(:@album).should == @album end test "#single sets the photo if album and photo_id is set and photo is published" do @cell.instance_variable_set(:@opts, {:section => @album.id, :photo_id => @second_photo.id}) @cell.single @cell.instance_variable_get(:@photo).should == @second_photo end test "#single sets the photo as first published album photo if only album is set" do @cell.instance_variable_set(:@opts, {:section => @album.id}) @cell.single @cell.instance_variable_get(:@photo).should == @first_photo end test "#single sets the photo if photo_id is set and photo is published" do @cell.instance_variable_set(:@opts, {:photo_id => @first_photo.id}) @cell.single @cell.instance_variable_get(:@photo).should == @first_photo end # FIXME test the cached_references # FIXME test the has_state option # FIXME should we just set the photo to nil or raise active_record::record_not_found like it is # doing now? # # test "#single does not set the photo if photo_id is set and photo is unpublished" do # @cell.instance_variable_set(:@opts, {:photo_id => @album.photos.last.id}) # @cell.single # @cell.instance_variable_get(:@photo).should == nil # end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
adva_cells-0.0.1 | test/unit/album_cell_test.rb |
adva-0.0.1 | adva_cells/test/unit/album_cell_test.rb |