Skip to content

Commit

Permalink
don't auto-update TMDB poster images once set
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Nov 5, 2012
1 parent a97eee5 commit dd205c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/models/movie.rb
Expand Up @@ -116,6 +116,9 @@ def tmdb_movie=(movie)
set_unless_locked(db_field, value) if value.present?
end

lock_value :poster_small_url if poster_small_url.present?
lock_value :poster_medium_url if poster_medium_url.present?

# same name properties
[:year, :runtime, :countries, :directors, :homepage].each do |property|
value = movie.send(property)
Expand Down
7 changes: 6 additions & 1 deletion spec/models/movie_spec.rb
Expand Up @@ -122,21 +122,26 @@ def collection
end

it "has locked values" do
tmdb = OpenStruct.new name: "Mr. Nobody", year: 2010
tmdb = OpenStruct.new name: "Mr. Nobody", year: 2010, poster_cover: 'poster:/url'
netflix = OpenStruct.new title: "Mr Nobody", year: 2009

movie = build tmdb_movie: tmdb
movie['rotten_tomatoes'] = rotten_values

movie.title.should == "Mr. Nobody"
movie.year.should == 2010
movie.poster_medium_url.should eq('poster:/url')

movie.netflix_title = netflix
movie.title.should == "Mr. Nobody"
movie.year.should == 2009

movie.tmdb_movie = tmdb
movie.year.should == 2009

tmdb2 = OpenStruct.new poster_cover: 'poster:/other'
movie.tmdb_movie = tmdb2
movie.poster_medium_url.should eq('poster:/url')
end

it "refreshes Rotten info" do
Expand Down

0 comments on commit dd205c5

Please sign in to comment.