Sha256: dabe923cc603ef8dc836b36c5dcc58066d5621542dde917682a48fb659f444c6

Contents?: true

Size: 1.08 KB

Versions: 21

Compression:

Stored size: 1.08 KB

Contents

require 'rails_helper'

describe PaidUp::Feature do
  include_context 'loaded site'

  it { should validate_presence_of(:slug) }
  it { should validate_presence_of(:title) }
  it { should validate_presence_of(:setting_type) }
  it { should validate_inclusion_of(:setting_type).in_array(%w(boolean table_rows rolify_rows))}

  context '#feature_model' do
    subject { groups_feature.feature_model }
    it { should eq Group }
  end

  context '#feature_model_name' do
    subject { groups_feature.feature_model_name }
    it { should eq 'Group' }
  end

  context '.raw' do
    subject { PaidUp::Feature.raw }
    it { should eq( { ad_free: ad_free_feature, groups: groups_feature, doodads: doodads_feature } ) }
  end

  context '.all' do
    subject { PaidUp::Feature.all }
    it { should eq [ad_free_feature, groups_feature, doodads_feature] }
  end

  context '.find_all' do
    subject { PaidUp::Feature.find_all( setting_type: 'rolify_rows') }
    it { should be_an Array }
  end

  context '.find' do
    subject { PaidUp::Feature.find(slug: 'groups') }
    it { should be_a PaidUp::Feature }
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
paid_up-0.7.6 spec/models/paid_up/feature_spec.rb