Sha256: ad6911815c97e164f36289605c1e3cd1f1a165a95624fa3cf2853e3decf0f7cd

Contents?: true

Size: 1.31 KB

Versions: 6

Compression:

Stored size: 1.31 KB

Contents

require 'rails_helper'
require "cancan/matchers"

describe Group do
  include_context 'groups'

  describe '#owners' do
    subject { first_group.owners }
    it { should include group_leader_subscriber }
    it { should_not include professional_subscriber }
  end

  describe '#save_with_owner' do
    subject {
      new_group = Group.new({title: 'Saved Group'})
      new_group.save_with_owner(professional_subscriber)
      new_group.reload.owners
    }
    it { should include professional_subscriber }
  end

  describe '#owners_enabled_count' do
    describe 'when limited' do
      subject { first_group.owners_enabled_count }
      it { should eq 1 }
    end
    describe 'when unlimited' do
      subject { second_group.owners_enabled_count }
      it { should eq PaidUp::Unlimited.to_i }
    end
  end

  describe '#owners_records' do
    subject { second_group.owners_records }
    it { should include third_group }
    it { should_not include first_group }
  end

  describe '#owners_records_count' do
    subject { second_group.owners_records_count }
    it { should eq 2 }
  end

  describe '#enabled?' do
    describe 'when true' do
      subject { first_group.enabled? }
      it { should eq true }
    end
    describe 'when false' do
      subject { disabled_group.enabled? }
      it { should eq false }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
paid_up-0.7.5 spec/models/group_spec.rb
paid_up-0.7.4 spec/models/group_spec.rb
paid_up-0.7.3 spec/models/group_spec.rb
paid_up-0.7.2 spec/models/group_spec.rb
paid_up-0.7.1 spec/models/group_spec.rb
paid_up-0.7.0 spec/models/group_spec.rb