Retrospring/spec/views/actions/_share.html.haml_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
1.0 KiB
Ruby
Raw Normal View History

2023-02-19 12:15:56 -08:00
# frozen_string_literal: true
require "rails_helper"
describe "actions/_share.html.haml", type: :view do
let(:answer) { FactoryBot.create(:answer, user: FactoryBot.create(:user)) }
subject(:rendered) do
render partial: "actions/share", locals: {
answer:,
}
end
it "has a dropdown item to share to twitter" do
expect(rendered).to have_css(%(a.dropdown-item[href^="https://twitter.com/"][target="_blank"]))
end
it "has a dropdown item to share to tumblr" do
expect(rendered).to have_css(%(a.dropdown-item[href^="https://www.tumblr.com/"][target="_blank"]))
end
it "has a dropdown item to share to telegram" do
expect(rendered).to have_css(%(a.dropdown-item[href^="https://t.me/"][target="_blank"]))
end
it "has a dropdown item to share to anywhere else" do
2023-11-11 14:08:14 -08:00
expect(rendered).to have_css(%(a.dropdown-item[data-action="share#share"]))
end
it "has a dropdown item to copy to clipboard" do
2023-11-12 03:06:59 -08:00
expect(rendered).to have_css(%(a.dropdown-item[data-action="clipboard#copy"]))
2023-02-19 12:15:56 -08:00
end
end