Sha256: 0a379087baae5b69bd3b538656d12f5f48790eb2c440c58502847457f331660c
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
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 } context "when there is goal without medal" do 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 end context "when goals have medal" do describe "when medals earned" do before do create :gamification_reward, rewardable: user, goal: goal end it 'returns medals' do expect(user.medals).to eq [medal] end 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.3 | spec/lib/gamification/concerns/rewardable_spec.rb |