Merge pull request 'Add lndhub admin panel, quick stats for admin pages' (#80) from feature/admin_stats into master
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #80 Reviewed-by: bumi <bumi@noreply.kosmos.org>
This commit was merged in pull request #80.
This commit is contained in:
@@ -4,7 +4,9 @@ RSpec.describe 'Admin dashboard', type: :feature do
|
||||
let(:user) { create :user }
|
||||
|
||||
before do
|
||||
allow(user).to receive(:is_admin?).and_return(true)
|
||||
allow(Devise::LDAP::Adapter).to receive(:get_ldap_param)
|
||||
.with(user.cn, :admin).and_return(["true"])
|
||||
|
||||
login_as user, :scope => :user
|
||||
end
|
||||
|
||||
|
||||
21
spec/features/admin/settings_spec.rb
Normal file
21
spec/features/admin/settings_spec.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Admin/global settings', type: :feature do
|
||||
let(:user) { create :user }
|
||||
|
||||
before do
|
||||
allow(Devise::LDAP::Adapter).to receive(:get_ldap_param)
|
||||
.with(user.cn, :admin).and_return(["true"])
|
||||
|
||||
login_as user, :scope => :user
|
||||
end
|
||||
|
||||
scenario 'Update reserved usernames' do
|
||||
visit admin_settings_registrations_path
|
||||
expect(Setting.reserved_usernames).not_to include(['Kosmos', 'Kredits'])
|
||||
|
||||
fill_in 'Reserved usernames', with: "Kosmos\nKredits"
|
||||
click_button "Save"
|
||||
expect(Setting.reserved_usernames).to eq(['Kosmos', 'Kredits'])
|
||||
end
|
||||
end
|
||||
@@ -71,6 +71,12 @@ RSpec.describe "Signup", type: :feature do
|
||||
fill_in "user_cn", with: "t"
|
||||
click_button "Continue"
|
||||
expect(page).to have_content("Username is too short")
|
||||
fill_in "user_cn", with: "-tony"
|
||||
click_button "Continue"
|
||||
expect(page).to have_content("Username is invalid")
|
||||
fill_in "user_cn", with: "$atoshi"
|
||||
click_button "Continue"
|
||||
expect(page).to have_content("Username is invalid")
|
||||
fill_in "user_cn", with: "jimmy"
|
||||
click_button "Continue"
|
||||
expect(page).to have_content("Username has already been taken")
|
||||
@@ -103,5 +109,11 @@ RSpec.describe "Signup", type: :feature do
|
||||
expect(page).to have_content("confirm your address")
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Reserved usernames" do
|
||||
fill_in "user_cn", with: "accounts"
|
||||
click_button "Continue"
|
||||
expect(page).to have_content("Username has already been taken")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user