Sha256: f3ca4313e5949059c7b348011054e3af1d36e95dcb1ee76c0796945963542769

Contents?: true

Size: 934 Bytes

Versions: 72

Compression:

Stored size: 934 Bytes

Contents

require 'spec_helper'

describe AvatarHelper, organization_workspace: :test do
  helper AvatarHelper

  let(:user) { create(:user, avatar: kids_avatars.last) }

  let(:kids_avatars) { create_list(:avatar, 4, target_audience: :kids) }
  let!(:grown_ups_avatars) { create_list(:avatar, 3, target_audience: :grown_ups) }

  let!(:kids_organization) { create(:organization, target_audience: :kids) }
  let!(:grown_ups_organization) { create(:organization, target_audience: :grown_ups, name: 'for_grown_ups') }

  describe 'avatars_for' do
    context 'with avatar in same target audience as organization' do
      before { kids_organization.switch! }
      it { expect(avatars_for(user)).to eq kids_avatars }
    end

    context 'with avatar in different target audience as organization' do
      before { grown_ups_organization.switch! }
      it { expect(avatars_for(user)).to eq grown_ups_avatars + [user.avatar] }
    end

  end
end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
mumuki-laboratory-9.23.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.22.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.21.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.20.1 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.20.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.19.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.18.1 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.18.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.17.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.16.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.15.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.14.1 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.14.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.13.2 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.13.1 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.13.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.12.1 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.12.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.11.0 spec/helpers/avatar_helper_spec.rb
mumuki-laboratory-9.10.0 spec/helpers/avatar_helper_spec.rb