test/unit/tmdb_cast_test.rb in ruby-tmdb-0.1.4 vs test/unit/tmdb_cast_test.rb in ruby-tmdb-0.2.1

- old
+ new

@@ -82,9 +82,28 @@ assert_kind_of OpenStruct, actor end end end + test "should not pass language to Tmdb.api_call if language is not supplied" do + Tmdb.expects(:api_call).with("Person.getInfo", 1, nil).returns([]) + Tmdb.expects(:api_call).with("Person.search", 1, nil).returns([]) + TmdbCast.find(:id => 1, :name => 1) + end + + test "should pass through language to Tmdb.api_call when language is supplied" do + Tmdb.expects(:api_call).with("Person.getInfo", 1, "foo").returns([]) + Tmdb.expects(:api_call).with("Person.search", 1, "foo").returns([]) + TmdbCast.find(:id => 1, :name => 1, :language => "foo") + end + + test "TmdbCast.new should raise error if supplied with raw data for cast member that doesn't exist" do + Tmdb.expects(:api_call).with('Person.getInfo', "1").returns(nil) + assert_raise ArgumentError do + TmdbCast.new({"id" => "1"}, true) + end + end + private def assert_cast_methodized(actor, cast_id) @cast_data = Tmdb.api_call('Person.getInfo', cast_id)[0] assert_equal @cast_data["popularity"], actor.popularity \ No newline at end of file