Add feature spec examples
With both logged in normal user and admin
This commit is contained in:
parent
3030d6f0f3
commit
1734b5c700
|
@ -4,5 +4,6 @@ FactoryBot.define do
|
|||
cn { "jimmy" }
|
||||
email { "jimmy@example.com" }
|
||||
password { "dis-muh-password" }
|
||||
confirmed_at { DateTime.now }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Admin dashboard', type: :feature do
|
||||
let(:user) { create :user }
|
||||
|
||||
before do
|
||||
allow(user).to receive(:is_admin?).and_return(true)
|
||||
login_as user, :scope => :user
|
||||
end
|
||||
|
||||
scenario 'View dashboard' do
|
||||
visit admin_root_path
|
||||
expect(page).to have_content('Admin Panel')
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Account dashboard', type: :feature do
|
||||
let(:user) { create :user }
|
||||
|
||||
before do
|
||||
login_as user, :scope => :user
|
||||
end
|
||||
|
||||
scenario 'View dashboard' do
|
||||
visit root_path
|
||||
expect(page).to have_content('Services')
|
||||
end
|
||||
end
|
|
@ -67,6 +67,7 @@ RSpec.configure do |config|
|
|||
# config.filter_gems_from_backtrace("gem name")
|
||||
|
||||
config.include Devise::Test::ControllerHelpers, :type => :controller
|
||||
config.include Warden::Test::Helpers
|
||||
config.include FactoryBot::Syntax::Methods
|
||||
config.extend ControllerMacros, :type => :controller
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue