mirror of
https://github.com/diaspora/diaspora.git
synced 2026-04-29 03:01:03 -04:00
hamlit v4 changed the default `attr_quote` from `'` to `"`. This is something we could switch back, but my hatered for single-quotes in HTML made me change the tests instead.
37 lines
1.2 KiB
Ruby
37 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
describe PostsController, type: :request do
|
|
context "with a poll" do
|
|
let(:sm) { FactoryBot.build(:status_message_with_poll, public: true) }
|
|
|
|
it "displays the poll" do
|
|
get "/posts/#{sm.id}", params: {format: :mobile}
|
|
|
|
expect(response.status).to eq(200)
|
|
expect(response.body).to match(/div class="poll"/)
|
|
expect(response.body).to match(/#{sm.poll.poll_answers.first.answer}/)
|
|
end
|
|
|
|
it "displays the correct percentage for the answers" do
|
|
alice.participate_in_poll!(sm, sm.poll.poll_answers.first)
|
|
bob.participate_in_poll!(sm, sm.poll.poll_answers.last)
|
|
get "/posts/#{sm.id}", params: {format: :mobile}
|
|
|
|
expect(response.status).to eq(200)
|
|
expect(response.body).to match(/div class="percentage pull-right">\n50%/)
|
|
end
|
|
end
|
|
|
|
context "with a location" do
|
|
let(:sm) { FactoryBot.build(:status_message_with_location, public: true) }
|
|
|
|
it "displays the location" do
|
|
get "/posts/#{sm.id}", params: {format: :mobile}
|
|
|
|
expect(response.status).to eq(200)
|
|
expect(response.body).to match(/"location nsfw-hidden"/)
|
|
expect(response.body).to match(/#{I18n.t("posts.show.location", location: sm.location.address)}/)
|
|
end
|
|
end
|
|
end
|