Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/themoviedb/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ def self.list(conditions = {})
end
end

def self.search(query)
def self.search(query, conditions = {})
search = Tmdb::Search.new
search.resource(endpoints[:singular].to_s)
search.query(query)
search.filter(conditions)
search.fetch.collect do |result|
new(result)
end
Expand Down
13 changes: 13 additions & 0 deletions spec/movie_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,19 @@
end
end

describe 'For a movie search' do
before(:each) do
VCR.use_cassette 'movie/search' do
@movies = Tmdb::Movie.search("House", year: 1977)
end
end

it 'should return movies from the year specified' do
# House (1977) doesn't appear in the first page unless year is specified
expect(@movies).to include(an_object_having_attributes(id: 25623))
end
end

describe 'For a movie detail with appended response' do
let(:append_fields) do
%w( alternative_titles credits images keywords releases
Expand Down
58 changes: 58 additions & 0 deletions spec/vcr/movie/search.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.