Address @nilsding's review changes

This commit is contained in:
Karina Kwiatek 2020-04-19 22:58:47 +01:00
parent c4164a8f34
commit 16ade832ca
2 changed files with 7 additions and 25 deletions

View File

@ -10,6 +10,13 @@ Rails.application.routes.draw do
mount Sidekiq::Web, at: "/sidekiq"
mount PgHero::Engine, at: "/pghero", as: "pghero"
match "/admin/announcements", to: "announcement#index", via: :get, as: :announcement_index
match "/admin/announcements", to: "announcement#create", via: :post, as: :announcement_create
match "/admin/announcements/new", to: "announcement#new", via: :get, as: :announcement_new
match "/admin/announcements/:id/edit", to: "announcement#edit", via: :get, as: :announcement_edit
match "/admin/announcements/:id", to: "announcement#update", via: :patch, as: :announcement_update
match "/admin/announcements/:id", to: "announcement#destroy", via: :delete, as: :announcement_destroy
end
# Moderation panel
@ -127,15 +134,5 @@ Rails.application.routes.draw do
match '/:username/groups(/p/:page)', to: 'user#groups', via: 'get', as: :show_user_groups, defaults: {page: 1}
match '/:username/questions(/p/:page)', to: 'user#questions', via: 'get', as: :show_user_questions, defaults: {page: 1}
constraints ->(req) { req.env['warden'].authenticate?(scope: :user) &&
(req.env['warden'].user.has_role?(:administrator)) } do
match "/admin/announcements", to: "announcement#index", via: :get, as: :announcement_index
match "/admin/announcements", to: "announcement#create", via: :post, as: :announcement_create
match "/admin/announcements/new", to: "announcement#new", via: :get, as: :announcement_new
match "/admin/announcements/:id/edit", to: "announcement#edit", via: :get, as: :announcement_edit
match "/admin/announcements/:id", to: "announcement#update", via: :patch, as: :announcement_update
match "/admin/announcements/:id", to: "announcement#destroy", via: :delete, as: :announcement_destroy
end
puts 'processing time of routes.rb: ' + "#{(Time.now - start).round(3).to_s.ljust(5, '0')}s".light_green
end

View File

@ -1,15 +0,0 @@
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the AnnouncementHelper. For example:
#
# describe AnnouncementHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe AnnouncementHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end