mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-25 07:06:48 +09:00
Hello world
First open source release of Campfire 🎉
This commit is contained in:
commit
df76a227dc
664 files changed
+36235
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,99 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class BoostingMessagesTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in "kevin@37signals.com"
|
||||
join_room rooms(:designers)
|
||||
end
|
||||
|
||||
test "boosting a message" do
|
||||
within_message messages(:third) do
|
||||
reveal_message_actions
|
||||
fill_in_boost_input "Good morning"
|
||||
click_on "Submit"
|
||||
assert_boost_text "Good morning"
|
||||
end
|
||||
end
|
||||
|
||||
test "deleting a boost" do
|
||||
using_session("David") do
|
||||
sign_in "david@37signals.com"
|
||||
join_room rooms(:designers)
|
||||
|
||||
within "#" + dom_id(boosts(:first)) do
|
||||
find("span", text: "Hello").click
|
||||
assert_selector "button", text: "Delete this boost", wait: 5
|
||||
click_on "Delete this boost"
|
||||
end
|
||||
|
||||
assert_no_text "Hello"
|
||||
end
|
||||
end
|
||||
|
||||
test "message update preserves the input state" do
|
||||
within_message messages(:third) do
|
||||
assert_message_text "Third time's a charm."
|
||||
reveal_message_actions
|
||||
fill_in_boost_input "Hey!"
|
||||
end
|
||||
|
||||
using_session("JZ") do
|
||||
sign_in "jz@37signals.com"
|
||||
join_room rooms(:designers)
|
||||
|
||||
within_message messages(:third) do
|
||||
reveal_message_actions
|
||||
find(".message__edit-btn").click
|
||||
|
||||
fill_in_rich_text_area "message_body", with: "Redacted!"
|
||||
click_on "Save changes"
|
||||
end
|
||||
end
|
||||
|
||||
within_message messages(:third) do
|
||||
assert_message_text "Redacted!"
|
||||
assert_boost_input_value "Hey!"
|
||||
end
|
||||
end
|
||||
|
||||
test "boost by another user preserves the input state" do
|
||||
within_message messages(:third) do
|
||||
assert_message_text "Third time's a charm."
|
||||
reveal_message_actions
|
||||
fill_in_boost_input "Hey!"
|
||||
end
|
||||
|
||||
using_session("David") do
|
||||
sign_in "david@37signals.com"
|
||||
join_room rooms(:designers)
|
||||
|
||||
within_message messages(:third) do
|
||||
reveal_message_actions
|
||||
fill_in_boost_input "Morning"
|
||||
click_on "Submit"
|
||||
assert_boost_text "Morning"
|
||||
end
|
||||
end
|
||||
|
||||
perform_enqueued_jobs
|
||||
|
||||
within_message messages(:third) do
|
||||
assert_boost_text "Morning"
|
||||
assert_boost_input_value "Hey!"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def fill_in_boost_input(text)
|
||||
click_on "New boost"
|
||||
fill_in "boost[content]", with: text
|
||||
end
|
||||
|
||||
def assert_boost_input_value(text)
|
||||
assert page.has_field? "boost[content]", with: text
|
||||
end
|
||||
|
||||
def assert_boost_text(text, **options)
|
||||
assert_selector ".boost", text: text, **options
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class SendingMessagesTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in "jz@37signals.com"
|
||||
join_room rooms(:designers)
|
||||
end
|
||||
|
||||
test "sending messages between two users" do
|
||||
using_session("Kevin") do
|
||||
sign_in "kevin@37signals.com"
|
||||
join_room rooms(:designers)
|
||||
end
|
||||
|
||||
join_room rooms(:designers)
|
||||
send_message "Is this thing on?"
|
||||
|
||||
using_session("Kevin") do
|
||||
join_room rooms(:designers)
|
||||
assert_message_text "Is this thing on?"
|
||||
|
||||
send_message "👍👍"
|
||||
end
|
||||
|
||||
join_room rooms(:designers)
|
||||
assert_message_text "👍👍"
|
||||
end
|
||||
|
||||
test "editing messages" do
|
||||
using_session("Kevin") do
|
||||
sign_in "kevin@37signals.com"
|
||||
join_room rooms(:designers)
|
||||
end
|
||||
|
||||
within_message messages(:third) do
|
||||
reveal_message_actions
|
||||
find(".message__edit-btn").click
|
||||
fill_in_rich_text_area "message_body", with: "Redacted!"
|
||||
click_on "Save changes"
|
||||
end
|
||||
|
||||
using_session("Kevin") do
|
||||
join_room rooms(:designers)
|
||||
|
||||
assert_message_text "Redacted!"
|
||||
end
|
||||
end
|
||||
|
||||
test "deleting messages" do
|
||||
using_session("Kevin") do
|
||||
sign_in "kevin@37signals.com"
|
||||
join_room rooms(:designers)
|
||||
|
||||
assert_message_text "Third time's a charm."
|
||||
end
|
||||
|
||||
within_message messages(:third) do
|
||||
reveal_message_actions
|
||||
find(".message__edit-btn").click
|
||||
|
||||
accept_confirm do
|
||||
click_on "Delete message"
|
||||
end
|
||||
end
|
||||
|
||||
using_session("Kevin") do
|
||||
assert_message_text "Third time's a charm.", count: 0
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class UnreadRoomsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in "jz@37signals.com"
|
||||
end
|
||||
|
||||
test "sending messages between two users" do
|
||||
designers_room = rooms(:designers)
|
||||
hq_room = rooms(:hq)
|
||||
|
||||
join_room hq_room
|
||||
assert_room_read hq_room
|
||||
|
||||
using_session("Kevin") do
|
||||
sign_in "kevin@37signals.com"
|
||||
join_room designers_room
|
||||
send_message("Hello!!")
|
||||
send_message("Talking to myself?")
|
||||
end
|
||||
|
||||
assert_room_unread designers_room
|
||||
|
||||
join_room designers_room
|
||||
assert_room_read designers_room
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user