docbrown/spec/requests/admin/invitations_spec.rb
Josh Puetz 1c566e0ec4
[deploy] Move /internal to `/admin (#9639)
* First draft - all the big changes

* Changing some more references to 'internal'

* Relocate internal request tests to admin

* Relocate internal system tests to admin

* Fix trailing space

* Test fix

* Move queries from internal to admin

* Docs updates

* Rename internal stimuls controllers to admin (plus docs)

* Rename admin layout

* Fix routing after rebase

* Fixes for latest added admin interfaces

* Serviceworker ignore paths
2020-08-07 10:36:26 -04:00

33 lines
873 B
Ruby

require "rails_helper"
RSpec.describe "/admin/invitations", type: :request do
let(:user) { create(:user) }
let(:admin) { create(:user, :super_admin) }
before do
sign_in(admin)
end
describe "GETS /admin/invitations" do
it "renders to appropriate page" do
user.update_column(:registered, false)
get "/admin/invitations"
expect(response.body).to include(user.username)
end
end
describe "GETS /admin/invitations/new" do
it "renders to appropriate page" do
get "/admin/invitations/new"
expect(response.body).to include("Email:")
end
end
describe "POST /admin/invitations" do
it "creates new invitation" do
post "/admin/invitations",
params: { user: { email: "hey#{rand(1000)}@email.co", name: "Roger #{rand(1000)}" } }
expect(User.last.registered).to be false
end
end
end