Files
growstuff/spec/features/conversations/index_spec.rb
Daniel O'Connor 8b4f0771c5 Ruby 3.2: Rubocop - Fix Negation matcher (#3780)
* Ruby 3.2/Bundler 2.4

* Fix creation

* Upgrade to js-routes 2. Put all js routes into a global namespace.

* Remove js-routes

* Remove

* Adjust ownership

* Appease codeclimate for the nth time

* Fix deprecation warning by explicitly calling to_fs

* Fix deprecation warning by explicitly calling to_fs

* Fix deprecation warning by explicitly calling to_fs

* Swap to will paginate successor for bootstrap

* Update app/views/members/show.html.haml

* Update app/views/plantings/index.rss.haml

* Update .env

* Update .devcontainer/.env

* Fix spec

* Update spec

* Fix spec

* Pin to 2.4.22

* 3 space indent

* Regenerate

* Update rubocop

* Rubocop

* More rubocop

* Regenerate

* Fix Capybara/NegationMatcher
2024-07-13 15:20:11 +09:30

89 lines
2.5 KiB
Ruby

# frozen_string_literal: true
require 'rails_helper'
describe "Conversations", :js do
let(:sender) { create(:member) }
let(:recipient) { create(:member, login_name: 'beyonce') }
before do
sender.send_message(recipient, "this is the body", "something i want to say")
login_as recipient
end
describe "Read conversations list" do
before do
visit root_path
click_link recipient.login_name
click_link 'Inbox'
end
include_examples 'is accessible'
it { expect(page).to have_content 'something i want to say' }
it { page.percy_snapshot(page, name: 'conversations#index') }
describe 'deleting' do
before do
check 'conversation_ids[]'
click_button 'Delete'
end
describe 'view trash' do
before { click_link 'trash' }
it { expect(page).to have_content 'something i want to say' }
describe 'restore conversation' do
before { click_link class: 'restore' }
it { expect(page).to have_no_content 'something i want to say' }
describe 'conversation was restored' do
before { click_link 'inbox' }
it { expect(page).to have_content 'something i want to say' }
end
end
end
end
end
describe 'deleting conversations' do
it 'deletes multiple conversations from the inbox' do
sender.send_message(recipient, 'this is a message', 'message 1')
sender.send_message(recipient, 'this is another message', 'follow up message')
visit root_path
click_link recipient.login_name
click_link 'Inbox'
all('input[type=checkbox]').each(&:click)
click_button 'Delete'
expect(page).to have_no_content 'this is a message'
expect(page).to have_no_content 'this is another message'
end
it 'deletes multiple conversations from the sentbox' do
sender.send_message(recipient, 'this is a message', 'message 1')
sender.send_message(recipient, 'this is another message', 'follow up message')
visit root_path
click_link recipient.login_name
click_link 'Inbox'
expect(page).to have_selector('.sent')
find('.sent').click
all('input[type=checkbox]').each(&:click)
click_button 'Delete'
expect(page).to have_selector('.sent')
find('.sent').click
expect(page).to have_no_content 'this is a message'
expect(page).to have_no_content 'this is another message'
end
end
end