test/unit/tmdb_test.rb in ruby-tmdb-0.0.20 vs test/unit/tmdb_test.rb in ruby-tmdb-0.0.21

- old
+ new

@@ -26,9 +26,18 @@ test "getting nonexistent URL returns response object" do test_response = Tmdb.get_url('http://thisisaurlthatdoesntexist.co.nz') assert_equal 404, test_response.code.to_i end + test "api_call should raise exception if api_key is not set" do + old_api_key = Tmdb.api_key + Tmdb.api_key = "" + assert_raises ArgumentError do + Tmdb.api_call('Movie.search', 'Transformers') + end + Tmdb.api_key = old_api_key + end + test "should perform Movie.search API call and return array of results" do movies = Tmdb.api_call('Movie.search', 'Transformers') assert_kind_of Array, movies assert movies.length > 1 movies.each do |movie| \ No newline at end of file