Sha256: 535e31996eab1905576f4046db22bf1e21f325054dcc84f006fa9b7753550897

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

require File.dirname(__FILE__) + '/../../test_helper.rb'

LINK_HASH = {"resource" => {"type" => "image","src" => "http:\/\/graphics8.nytimes.com\/images\/2007\/03\/02\/movies\/scott.163.jpg", "height" => 234, "width" => 345,"credit" => "Tony Cenicola\/<br>The New York Times"}}.freeze


class TestNytimes::TestMovies::TestMultimediaLink < Test::Unit::TestCase
	context "MultimediaLink.create_from_api" do
		setup do
			@link = Nytimes::Movies::MultimediaLink.create_from_api(LINK_HASH)
		end
		
		should "return an instance of MultimediaLink" do
		  assert_kind_of(Nytimes::Movies::MultimediaLink, @link)
		end
		
		should "assign the @media_type attribute from the 'type' key in the hash" do
		  assert_equal(LINK_HASH['resource']['type'], @link.media_type)
		end
		
		should "assign the @url attribute from the 'src' key in the hash" do
		  assert_equal(LINK_HASH['resource']['src'], @link.url)
		end
		
		should "assign the @height attribute from the 'height' key in the hash" do
		  assert_equal(LINK_HASH['resource']['height'], @link.height)
		end
		
		should "assign the @width attribute from the 'width' key in the hash" do
		  assert_equal(LINK_HASH['resource']['width'], @link.width)
		end
		
		should "assign the @credit attribute from the 'credit' key in the hash" do
		  assert_equal(LINK_HASH['resource']['credit'], @link.credit)
		end
	end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
harrisj-nytimes-movies-0.1.0 test/nytimes/movies/test_multimedia_link.rb
harrisj-nytimes-movies-0.1.1 test/nytimes/movies/test_multimedia_link.rb
nytimes-movies-0.1.1 test/nytimes/movies/test_multimedia_link.rb