Sha256: 1845476fa7f7d51366988ccfaa3e3d81aedaa1bdd339b4af45aac832f6b8fadc
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 KB
Contents
require_relative '../test_helper' # TODO: rewrite tests using Minitest best practices describe TMDB::Movie do # Create a 'test/api_key' file and paste in your API key to run the tests # TODO: Work in 'gem webmock' for offline testing, review: http://code.tutsplus.com/articles/writing-an-api-wrapper-in-ruby-with-tdd--net-23875 TMDB::API.api_key = API_KEY # TMDB::Movie::title_search(query, page, etc.) describe ".title_search" do it "should return correct results" do movies = TMDB::Movie.title_search(query: 'the matrix') movies.first.title.must_equal "The Matrix" end end # TMDB::Movie::seach(release_date.gte, page, etc.) describe ".search" do it "should return recent results" do movies = TMDB::Movie.search('release_date.gte' => '2014-01-01', 'release_date.lte' => (Time.now.strftime("%Y-%m-%d")), primary_release_year: 2014) # Some of these might fail because release_date.lte/gte search all available release dates movies.each do |movie| movie[:release_date].must_be :<, Time.now.to_s movie[:release_date].must_be :>, '2014-01-01' end end end # TMDB::Movie::id(movie_id) describe ".id" do let (:movie) { TMDB::Movie.id(550) } it "should return the correct movie" do movie.title.must_equal "Fight Club" end it "should allow iterating over results with multiple values" do movie.genres.first.name.must_equal "Action" movie.genres.last.name.must_equal "Thriller" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tmdb-0.3.0 | test/tmdb/test_movie.rb |
tmdb-0.2.1 | test/tmdb/test_movie.rb |