Sha256: 23e8234c58296fbab8798802d20cfb21f04f2284554bc7c8c5e8016ebef70a15

Contents?: true

Size: 1.83 KB

Versions: 2

Compression:

Stored size: 1.83 KB

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'paid_up/plans/index' do
  include_context 'loaded site'

  before do
    view.extend PaidUp::PlansHelper
    view.extend PaidUp::FeaturesHelper
    view.extend BootstrapLeatherHelper
  end

  context 'when user is anonymous' do
    before do
      assign(:current_user, access_anonymous)
      assign(:plans, PaidUp::Plan.subscribable)
      render
    end
    context 'displays the subscribable plans' do
      subject { rendered }
      it { should include 'Free' }
      it { should have_css '.free_subscribe_button .btn-success' }
      it { should include 'No Ads' }
      it { should have_css '.no_ads_subscribe_button .btn-success' }
      it { should include 'Group Leader' }
      it { should have_css '.group_leader_subscribe_button .btn-success' }
      it { should include 'Professional' }
      it { should have_css '.professional_subscribe_button .btn-success' }
      it { should_not include 'Error' }
      it { should_not include 'Anonymous' }
    end
  end

  context 'when user is logged in as professional subscriber' do
    before do
      assign(:current_user, login_subscriber(prof_subscriber))
      assign(:plans, PaidUp::Plan.subscribable)
      render
    end
    context 'displays all the plans' do
      subject { rendered }
      it { should include 'Free' }
      it { should have_css '.free_subscribe_button .btn-danger' }
      it { should include 'No Ads' }
      it { should have_css '.no_ads_subscribe_button .btn-danger' }
      it { should include 'Group Leader' }
      it { should have_css '.group_leader_subscribe_button .btn-danger' }
      it { should include 'Professional' }
      it { should have_css '.professional_subscribe_button .btn-disabled' }
      it { should_not include 'Error' }
      it { should_not include 'Anonymous' }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paid_up-0.12.4 spec/views/paid_up/plans_spec.rb
paid_up-0.12.3 spec/views/paid_up/plans_spec.rb