diff --git a/app/helpers/movie_person_profiles_helper.rb b/app/helpers/movie_person_profiles_helper.rb
index cdc1fbb7..44fd5a69 100644
--- a/app/helpers/movie_person_profiles_helper.rb
+++ b/app/helpers/movie_person_profiles_helper.rb
@@ -7,4 +7,8 @@ def display_birthday_info(profile)
date = profile.birthday.to_date.stamp('January 1st, 2018')
profile.deathday.blank? ? "#{date} (Age: #{profile.age})" : "#{date}, Deceased (Age: #{profile.age})"
end
+
+ def actor_movie_posters_uri(actor)
+ "#{root_url}tmdb/actor_search?actor=#{actor.name.gsub(' ', '+')}"
+ end
end
diff --git a/app/views/tmdb/_movie_credits.html.erb b/app/views/tmdb/_movie_credits.html.erb
index 161cfeca..74046ac3 100644
--- a/app/views/tmdb/_movie_credits.html.erb
+++ b/app/views/tmdb/_movie_credits.html.erb
@@ -1,8 +1,11 @@
-
Movie Credits (<%= @person_movie_credits.actor.size %>)
+
+ <%= link_to 'Movie Poster View', actor_movie_posters_uri(person_profile), style: 'float: right;' %>
+ Movie Credits (<%= @person_movie_credits.actor.size %>)
+
<% @person_movie_credits.actor.each do |credit| %>
- <%= link_to credit.title, movie_more_path(tmdb_id: "#{credit.tmdb_id}") %>
<%= " | #{credit.date} " if credit.date != "Date unavailable" %>
<%= "| As #{credit.character}" if credit.character.present? %>
<% end %>
-
\ No newline at end of file
+
diff --git a/app/views/tmdb/actor_more.html.erb b/app/views/tmdb/actor_more.html.erb
index 9bfaf2ae..d2b68ca2 100644
--- a/app/views/tmdb/actor_more.html.erb
+++ b/app/views/tmdb/actor_more.html.erb
@@ -13,7 +13,7 @@
- <%= render "movie_credits" %>
+ <%= render partial: "movie_credits", locals: { person_profile: @person_profile } %>
<%= render "tv_credits" %>
diff --git a/spec/helpers/movie_person_profiles_helper_spec.rb b/spec/helpers/movie_person_profiles_helper_spec.rb
index b6e2b8ca..3809c84b 100644
--- a/spec/helpers/movie_person_profiles_helper_spec.rb
+++ b/spec/helpers/movie_person_profiles_helper_spec.rb
@@ -3,11 +3,10 @@
require 'rails_helper'
describe MoviePersonProfilesHelper, type: :helper do
- let(:profile) { build(:movie_person_profile) }
+ let(:profile) { build(:movie_person_profile, name: 'Geoff Jefferson') }
let(:living_profile) { build(:living_movie_person_profile) }
let(:deceased_profile) { build(:deceased_movie_person_profile) }
-
describe '#display_birthday_info' do
it 'includes the word version of the birthdate in the returned string' do
profile.birthday = '2000-01-28'
@@ -43,4 +42,12 @@
expect(display_birthday_info(profile)).to eq('Not available')
end
end
+
+ describe '#actor_movie_posters_uri' do
+ it "generates a uri based on the actor's name" do
+ expected_segment = 'tmdb/actor_search?actor=Geoff+Jefferson'
+ actual_uri = actor_movie_posters_uri(profile)
+ expect(actual_uri).to include(expected_segment)
+ end
+ end
end