test/unit/tmdb_test.rb in ruby-tmdb3-0.3.2 vs test/unit/tmdb_test.rb in ruby-tmdb3-0.3.3

- old
+ new

@@ -49,11 +49,11 @@ data = "hello" language = "blah" url = Tmdb.base_api_url + '/' + method + "?api_key=" + Tmdb.api_key + "&language=" + language + '&query=' + CGI::escape(data.to_s) mock_response = stub(:code => "200", :body => '{"page":1,"results":[],"total_pages":0,"total_results":0}') Tmdb.expects(:get_url).with(url).returns(mock_response) - Tmdb.api_call(method, {query: data}, language) + Tmdb.api_call(method, {:query => data}, language) end test "api_call should raise exception if api_key is not set" do old_api_key = Tmdb.api_key Tmdb.api_key = "" @@ -62,11 +62,11 @@ end Tmdb.api_key = old_api_key end test "should perform search/movie API call and return a Hash with an array of results" do - movies = Tmdb.api_call("search/movie", {query: "Transformers"}) + movies = Tmdb.api_call("search/movie", {:query => "Transformers"}) assert_kind_of Hash, movies assert_kind_of Array, movies["results"] movies["results"].each do |movie| assert_kind_of Hash, movie %w(original_title id).each do |item| @@ -74,43 +74,43 @@ end end end test "should perform movie API call and return a single result" do - result = Tmdb.api_call("movie", {id: "187"}) + result = Tmdb.api_call("movie", {:id => "187"}) assert_kind_of Hash, result %w(original_title id).each do |item| assert_not_nil result[item] end end test "should perform movie API call with an action and return a single result" do - result = Tmdb.api_call("movie/images", {id: "187"}) + result = Tmdb.api_call("movie/images", {:id => "187"}) assert_kind_of Hash, result %w(posters id).each do |item| assert_not_nil result[item] end end test "should perform Movie.imdbLookup API call and return a single result" do - result = Tmdb.api_call("movie", {id: "tt0401792"}) + result = Tmdb.api_call("movie", {:id => "tt0401792"}) assert_kind_of Hash, result %w(original_title id).each do |item| assert result[item] end end test "should perform person API call and return a single result" do - result = Tmdb.api_call("person", {id: 287}) + result = Tmdb.api_call("person", {:id => 287}) assert_kind_of Hash, result %w(homepage id name).each do |item| assert_not_nil result[item] end end test "should perform search/person API call and return a Hash with an array of results" do - people = Tmdb.api_call("search/person", {query: "vince"}) + people = Tmdb.api_call("search/person", {:query => "vince"}) assert_kind_of Array, people["results"] people["results"].each do |person| assert_kind_of Hash, person %w(id name).each do |item| assert_not_nil person[item] @@ -123,18 +123,18 @@ movies = Tmdb.api_call('Movie.blarg', 'Transformers') end end test "API call that finds no results should return nil" do - movies = Tmdb.api_call('search/movie', {query: "item_not_found"}) + movies = Tmdb.api_call('search/movie', {:query => "item_not_found"}) assert_nil movies end test "API call cache should not be changed when data altered in the receiving method" do - person = Tmdb.api_call("person", {id: 287}) + person = Tmdb.api_call("person", {:id => 287}) assert_not_nil person[person.keys[0]] person[person.keys[0]] = nil - person = Tmdb.api_call("person", {id: 287}) + person = Tmdb.api_call("person", {:id => 287}) assert_not_nil person[person.keys[0]] end test "data_to_object should create object from nested data structures" do test_data = {