Files
growstuff/spec/features/admin/forums_spec.rb
Daniel O'Connor ee45b518ce Rubocop fixes (Stacked PR) (#3454)
* Fix todo

* Rubcop

* Rubocop

* Rubocop

* Rename harvests_routing_spec.rb to harvests_controller_routing_spec.rb

Making codeclimate happier

* Rename for CodeFactor: updates_routing_spec.rb to posts_controller_updates_routing_spec.rb

For codefactor

* Rename for CodeFactor: follows_routing_spec.rb to follows_controller_routing_spec.rb

* Rename for CodeFactor: forums_routing_spec.rb to forums_controller_routing_spec.rb

* Rename spec/routing/roles_routing_spec.rb to spec/routing/admin/roles_controller_routing_spec.rb

* Rename authentications_routing_spec.rb to authentications_controller_routing_spec.rb

* Rename for CodeFactor: plantings_routing_spec.rb to plantings_controller_routing_spec.rb

* Rename for CodeFactor: scientific_names_routing_spec.rb to scientific_names_controller_routing_spec.rb

* Rename for CodeFactor: seeds_routing_spec.rb to seeds_controller_routing_spec.rb

* Rename for CodeFactor: comments_routing_spec.rb to comments_controller_routing_spec.rb

* Rename for CodeFactor: garden_types_routing_spec.rb to garden_types_controller_routing_spec.rb

* Rename for CodeFactor: admin_routing_spec.rb to admin_controller_routing_spec.rb

* Rename for CodeFactor: gardens_routing_spec.rb to gardens_controller_routing_spec.rb

* Rename for CodeFactor: photos_routing_spec.rb to photos_controller_routing_spec.rb

* Rename for CodeFactor: plant_parts_routing_spec.rb to plant_parts_controller_routing_spec.rb

* Rename for CodeFactor: crops_routing_spec.rb to crops_controller_routing_spec.rb

* [CodeFactor] Apply fixes

* Rename

* Code factor bot

---------

Co-authored-by: Cesy <cesy.avon@gmail.com>
Co-authored-by: codefactor-io <support@codefactor.io>
2024-01-07 21:05:59 +10:30

61 lines
1.6 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"
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