Sha256: 0d3815d8ee58421e1ed5188ba0c4ffe57221bbf9b987ddf5ebb47afade2c314f

Contents?: true

Size: 1.84 KB

Versions: 18

Compression:

Stored size: 1.84 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 BootstrapLeather::ApplicationHelper
  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

18 entries across 18 versions & 1 rubygems

Version Path
paid_up-0.13.21 spec/views/paid_up/plans_spec.rb
paid_up-0.13.17 spec/views/paid_up/plans_spec.rb
paid_up-0.13.16 spec/views/paid_up/plans_spec.rb
paid_up-0.13.14 spec/views/paid_up/plans_spec.rb
paid_up-0.13.13 spec/views/paid_up/plans_spec.rb
paid_up-0.13.12 spec/views/paid_up/plans_spec.rb
paid_up-0.13.11 spec/views/paid_up/plans_spec.rb
paid_up-0.13.10 spec/views/paid_up/plans_spec.rb
paid_up-0.13.9 spec/views/paid_up/plans_spec.rb
paid_up-0.13.8 spec/views/paid_up/plans_spec.rb
paid_up-0.13.7 spec/views/paid_up/plans_spec.rb
paid_up-0.13.6 spec/views/paid_up/plans_spec.rb
paid_up-0.13.5 spec/views/paid_up/plans_spec.rb
paid_up-0.13.4 spec/views/paid_up/plans_spec.rb
paid_up-0.13.3 spec/views/paid_up/plans_spec.rb
paid_up-0.13.2 spec/views/paid_up/plans_spec.rb
paid_up-0.13.1 spec/views/paid_up/plans_spec.rb
paid_up-0.13.0 spec/views/paid_up/plans_spec.rb