about summary refs log tree commit diff
path: root/spec/lib/inline_rabl_scope_spec.rb
blob: 3fff176e46cc7661d7c3b226db26b32f298e3599 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

require 'rails_helper'

describe InlineRablScope do
  describe '#current_account' do
    it 'returns the given account' do
      account = Fabricate(:account)
      expect(InlineRablScope.new(account).current_account).to eq account
    end
  end

  describe '#current_user' do
    it 'returns nil if the given account is nil' do
      expect(InlineRablScope.new(nil).current_user).to eq nil
    end

    it 'returns user of account if the given account is not nil' do
      user = Fabricate(:user)
      expect(InlineRablScope.new(user.account).current_user).to eq user
    end
  end
end