docbrown/spec/requests/admin/moderator_logs_spec.rb
Ridhwana 3a4da2dd5a
RFC 50: Remove hardcoded paths and use path_helpers instead (in the specs) (#13549)
* feat: update the paths in the spec files

* feat: update hardcoded paths with path helpers

* chore: update hardcoded paths to path helpers

* chore: hardcode describe blocks

* chore: oops

* feat: update some more hardcoded to use link_to's

* fix broken tests

* chore: admin_articles path

* chore: oops remove rails helper

* feat: add starting /

* chore: more pre slashes

* chore: add pre slashes

* chore: some small typos

* fix: oops
2021-04-28 21:32:51 +02:00

26 lines
707 B
Ruby

require "rails_helper"
RSpec.describe "/admin/content_manager/tags", type: :request do
let(:super_admin) { create(:user, :super_admin) }
let(:tag_moderator) { build_stubbed(:user) }
let!(:tag) { create(:tag) }
let(:listener) { :moderator }
before do
sign_in super_admin
Audit::Subscribe.listen listener
end
after do
Audit::Subscribe.forget listener
end
describe "PUT /admin/content_manager/tags/:id" do
it "creates entry for #update action" do
put admin_tag_path(tag.id), params: { id: tag.id, tag: { short_summary: Faker::Hipster.sentence } }
log = AuditLog.where(user_id: super_admin.id, slug: :update)
expect(log.count).to eq(1)
end
end
end