test/unit/tmdb_movie_test.rb in ruby-tmdb-0.1.0 vs test/unit/tmdb_movie_test.rb in ruby-tmdb-0.1.1

- old
+ new

@@ -4,10 +4,17 @@ def setup register_api_url_stubs end + test "movie should be able to be dumped and re-loaded" do + assert_nothing_raised do + movie = TmdbMovie.find(:id => 187) + TmdbMovie.new(movie.raw_data) + end + end + test "find by id should return the full movie data" do movie = TmdbMovie.find(:id => 187) assert_movie_methodized(movie, 187) end @@ -20,47 +27,47 @@ test "find by imdb should return the full movie data" do movie = TmdbMovie.find(:imdb => "tt0401792") assert_movie_methodized(movie, 187) end - test "find by title should return the full movie data" do - movie = TmdbMovie.find(:title => "Sin City", :limit => 1) + test "find by title should return the full movie data when expand_results set to true" do + movie = TmdbMovie.find(:title => "Transformers: Revenge of the Fallen", :limit => 1, :expand_results => true) assert_movie_methodized(movie, 187) end test "should raise exception if no arguments supplied to find" do assert_raise ArgumentError do TmdbMovie.find() end end test "find by id should return a single movie" do - assert_kind_of TmdbMovie, TmdbMovie.find(:id => 187) + assert_kind_of OpenStruct, TmdbMovie.find(:id => 187) end test "find by imdb should return a single movie" do - assert_kind_of TmdbMovie, TmdbMovie.find(:imdb => "tt0401792") + assert_kind_of OpenStruct, TmdbMovie.find(:imdb => "tt0401792") end test "find by title should return an array of movies" do movies = TmdbMovie.find(:title => "Iron Man") assert_kind_of Array, movies movies.each do |movie| - assert_kind_of TmdbMovie, movie + assert_kind_of OpenStruct, movie end end test "find by title with limit=1 should return a single movie" do - assert_kind_of TmdbMovie, TmdbMovie.find(:title => "Iron Man", :limit => 1) + assert_kind_of OpenStruct, TmdbMovie.find(:title => "Iron Man", :limit => 1) end test "find by title with limit=X should return an array of X movies" do (2..5).each do |x| movies = TmdbMovie.find(:title => "Iron Man", :limit => x) assert_kind_of Array, movies assert_equal x, movies.length movies.each do |movie| - assert_kind_of TmdbMovie, movie + assert_kind_of OpenStruct, movie end end end test "should raise error if limit is smaller than 1" do \ No newline at end of file