Sha256: 743b558edbabfb80111771fe3274fff76ab2ff24e2c6b5dd12f56193b5f41d70

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 Bytes

Contents

require 'spec_helper'

describe Gamification::Concerns::Rewardable do
  describe '#medals' do
    let(:user)  { create :user }
    let(:medal) { create :gamification_medal }
    let(:goal)  { create :gamification_goal, medal: medal }
    let(:goal_without_medal)  { create :gamification_goal }

    describe "when medals earned" do
      before do
        create :gamification_reward, rewardable: user, goal: goal
        create :gamification_reward, rewardable: user, goal: goal_without_medal
      end

      it 'returns medals' do
        expect(user.medals).to eq [medal]
      end
    end

    describe "when no medals earned" do
      it 'returns empty array when no medals' do
        expect(user.medals).to eq []
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gamification-1.0.2 spec/lib/gamification/concerns/rewardable_spec.rb