mirror of
https://github.com/Growstuff/growstuff.git
synced 2025-12-31 13:37:49 -05:00
* Upgrade boostrap * Remove deprecated bootstrap toggles * Migrate other details * Avoid accidentally including bootstrap twice * Avoid accidentally including bootstrap twice * Avoid accidentally including bootstrap twice * Fix spec * Fix spec, where the size of the screen has gone to a partial breakpoint/you can't click on your own name in tablet view * Fix spec * Cleanup * Cleanup
62 lines
1.7 KiB
Ruby
62 lines
1.7 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe "forums", :js do
|
|
include_context 'signed in admin'
|
|
let(:forum) { create(:forum) }
|
|
|
|
describe "navigating to forum admin with js" do
|
|
before do
|
|
visit admin_path
|
|
within 'nav#site_admin' do
|
|
click_link "Forums"
|
|
end
|
|
end
|
|
|
|
it { expect(page).to have_current_path forums_path, ignore_query: true }
|
|
it { expect(page).to have_link "New forum" }
|
|
end
|
|
|
|
describe "adding a forum" do
|
|
before do
|
|
visit forums_path
|
|
click_link "New forum"
|
|
expect(page).to have_current_path new_forum_path, ignore_query: true
|
|
fill_in 'Name', with: 'Discussion'
|
|
fill_in 'Description', with: "this is a new forum"
|
|
select member.login_name, from: "Owner"
|
|
click_button 'Save'
|
|
end
|
|
|
|
it { expect(page).to have_current_path forum_path(Forum.last), ignore_query: true }
|
|
it { expect(page).to have_content 'Forum was successfully created' }
|
|
end
|
|
|
|
describe 'editing forum' do
|
|
before do
|
|
visit forum_path forum
|
|
click_link 'Edit'
|
|
fill_in 'Name', with: 'Something else'
|
|
click_button 'Save'
|
|
forum.reload
|
|
end
|
|
|
|
it { expect(page).to have_current_path forum_path(forum), ignore_query: true }
|
|
it { expect(page).to have_content 'Forum was successfully updated' }
|
|
it { expect(page).to have_content 'Something else' }
|
|
end
|
|
|
|
describe 'deleting forum' do
|
|
before do
|
|
visit forum_path forum
|
|
accept_confirm do
|
|
click_link 'Delete'
|
|
end
|
|
end
|
|
|
|
it { expect(page).to have_current_path forums_path, ignore_query: true }
|
|
it { expect(page).to have_content 'Forum was successfully deleted' }
|
|
end
|
|
end
|