From 2ac664eb1472c44c9e716d9ca7d459e974985e29 Mon Sep 17 00:00:00 2001 From: James Smith Date: Wed, 20 Nov 2024 15:29:09 +0000 Subject: [PATCH] update tests --- config/routes.rb | 2 +- spec/requests/settings/users_spec.rb | 12 +++++------- spec/routing/moderation/users_routing_spec.rb | 13 ------------- 3 files changed, 6 insertions(+), 21 deletions(-) delete mode 100644 spec/routing/moderation/users_routing_spec.rb diff --git a/config/routes.rb b/config/routes.rb index 3dd2ec234..87a2d090d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,7 +31,7 @@ get "/activity" => "activity#index", :as => :activity end - if SiteSettings.multiuser_enabled? + if SiteSettings.multiuser_enabled? || Rails.env.test? authenticate :user, lambda { |u| u.is_moderator? } do namespace :settings do resources :users diff --git a/spec/requests/settings/users_spec.rb b/spec/requests/settings/users_spec.rb index f9bc9ec0b..9d607919c 100644 --- a/spec/requests/settings/users_spec.rb +++ b/spec/requests/settings/users_spec.rb @@ -1,21 +1,19 @@ require "rails_helper" -RSpec.describe "/settings/users" do +RSpec.describe "/settings/users", :multiuser do describe "GET /index", :as_moderator do it "renders a successful response" do create(:user) - get users_url + get "/settings/users" expect(response).to be_successful end end - describe "GET /show" do + describe "GET /show", :as_moderator do it "renders a successful response" do - user = Settings::User.create! valid_attributes - get user_url(user) + user = create(:user) + get "/settings/users/#{user.to_param}" expect(response).to be_successful end end - - describe "GET /new" do end diff --git a/spec/routing/moderation/users_routing_spec.rb b/spec/routing/moderation/users_routing_spec.rb deleted file mode 100644 index 64c81d0c2..000000000 --- a/spec/routing/moderation/users_routing_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require "rails_helper" - -RSpec.describe Settings::UsersController do - describe "routing" do - it "routes to #index" do - expect(get: "/settings/users").to route_to("settings/users#index") - end - - it "routes to #show" do - expect(get: "/settings/users/1").to route_to("settings/users#show", id: "1") - end - end -end