diff --git a/_plugins/team.rb b/_plugins/team.rb index 3d2123f7a..654d9c5da 100644 --- a/_plugins/team.rb +++ b/_plugins/team.rb @@ -20,7 +20,6 @@ def team_photo(name) default end end - module_function :team_photo end end Liquid::Template.register_filter(Jekyll::TeamFilter) diff --git a/spec/_plugins/team_spec.rb b/spec/_plugins/team_spec.rb index a569443a4..051e5361d 100644 --- a/spec/_plugins/team_spec.rb +++ b/spec/_plugins/team_spec.rb @@ -2,12 +2,17 @@ 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 = "18F team member Aaron Snow" @@ -15,8 +20,7 @@ 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 = "18F logo" @@ -24,8 +28,7 @@ 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 = "18F logo"