Skip to content

Commit

Permalink
Merge pull request #2184 from 18F/hotfix-photos-2
Browse files Browse the repository at this point in the history
Hotfix for team_photo bug
  • Loading branch information
Corey Mahoney authored Jan 7, 2017
2 parents 94f7264 + 9662167 commit 5f117bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion _plugins/team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def team_photo(name)
default
end
end
module_function :team_photo
end
end
Liquid::Template.register_filter(Jekyll::TeamFilter)
15 changes: 9 additions & 6 deletions spec/_plugins/team_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,33 @@
require 'pry'

RSpec.describe Jekyll::TeamFilter do
class TeamFilterClass
end

before(:each) do
@team_filter = TeamFilterClass.new
@team_filter.extend(Jekyll::TeamFilter)
@baseurl = Jekyll.sites[0].config['baseurl']
end

it 'returns an image given a name that is an author and has an image' do
embed_filter = Jekyll::TeamFilter
actual = embed_filter.team_photo('aaron')
actual = @team_filter.team_photo('aaron')
expected = "<img class='img-circle team-img bio-clip'"\
" src='#{@baseurl}/assets/img/team/aaron.jpg' alt='18F team member Aaron Snow'>"

expect(expected).to eq actual
end

it 'returns an image given a name that is an author and does not have an image' do
embed_filter = Jekyll::TeamFilter
actual = embed_filter.team_photo('alan')
actual = @team_filter.team_photo('alan')
expected = "<img class='img-circle team-img bio-clip' "\
"src='#{@baseurl}/assets/img/logos/18F-Logo-M.png' alt='18F logo'>"

expect(expected).to eq actual
end

it 'returns an image given a name that is not an author and does not have an image' do
embed_filter = Jekyll::TeamFilter
actual = embed_filter.team_photo('invalid-name')
actual = @team_filter.team_photo('invalid-name')
expected = "<img class='img-circle team-img bio-clip' "\
"src='#{@baseurl}/assets/img/logos/18F-Logo-M.png' alt='18F logo'>"

Expand Down

0 comments on commit 5f117bc

Please sign in to comment.