mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 10:29:53 +01:00
Add spec for AvatarComponent
This commit is contained in:
parent
f97d98d00a
commit
ae4210d36f
1 changed files with 39 additions and 0 deletions
39
spec/components/avatar_component_spec.rb
Normal file
39
spec/components/avatar_component_spec.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe AvatarComponent, type: :component do
|
||||
let(:user) { FactoryBot.create(:user) }
|
||||
|
||||
it "renders an avatar" do
|
||||
expect(
|
||||
render_inline(described_class.new(user:, size: "sm")).to_html,
|
||||
).to include(
|
||||
"no_avatar.png",
|
||||
)
|
||||
end
|
||||
|
||||
it "gets the medium version of a profile picture if requested" do
|
||||
expect(
|
||||
render_inline(described_class.new(user:, size: "md")).to_html,
|
||||
).to include(
|
||||
"medium/",
|
||||
)
|
||||
end
|
||||
|
||||
it "gets the large version of a profile picture if requested" do
|
||||
expect(
|
||||
render_inline(described_class.new(user:, size: "xl")).to_html,
|
||||
).to include(
|
||||
"large/",
|
||||
)
|
||||
end
|
||||
|
||||
it "includes additionally passed classes" do
|
||||
expect(
|
||||
render_inline(described_class.new(user:, size: "md", classes: %w[first-class second-class])).to_html,
|
||||
).to include(
|
||||
'class="avatar-md first-class second-class"',
|
||||
)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue