2016-10-17 00:22:00 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe AccessRequest, type: :model do
|
2016-10-17 14:53:53 +00:00
|
|
|
let(:access_request) { create(:access_request) }
|
|
|
|
|
|
|
|
describe 'approve' do
|
|
|
|
before :each do
|
|
|
|
access_request.approve
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(access_request.approved).to be true }
|
|
|
|
it { expect(access_request.answered).to be true }
|
|
|
|
it { expect(UserMap.count).to eq 1 }
|
2016-12-13 03:28:10 +00:00
|
|
|
it { expect(Mailboxer::Notification.count).to eq 1 }
|
2016-10-17 14:53:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'deny' do
|
|
|
|
before :each do
|
|
|
|
access_request.deny
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(access_request.approved).to be false }
|
|
|
|
it { expect(access_request.answered).to be true }
|
|
|
|
it { expect(UserMap.count).to eq 0 }
|
2016-12-13 03:28:10 +00:00
|
|
|
it { expect(Mailboxer::Notification.count).to eq 0 }
|
2016-10-17 14:53:53 +00:00
|
|
|
end
|
2016-10-17 00:22:00 +00:00
|
|
|
end
|