Sha256: c530c76443cf8c230cc02336555d736600b143a1993d2fb38cd7198084ceade8

Contents?: true

Size: 1.44 KB

Versions: 36

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

describe WoopleTheme::Dashboard::ElectivesSectionPresenter do
  describe "#render_history" do
    describe "more than one completed elective" do
      let(:data) { stub_presenter(electives_history: [stub]) }

      subject { WoopleTheme::Dashboard::ElectivesSectionPresenter.new(data) }

      specify { expect { |b| subject.render_history(&b) }.to yield_control }
    end

    describe "0 completed/in-progress electives" do
      let(:data) { stub_presenter }

      subject { WoopleTheme::Dashboard::ElectivesSectionPresenter.new(data) }

      specify { expect { |b| subject.render_history(&b) }.not_to yield_control }
    end
  end

  describe "#render_exceptions" do
    describe "at least one elective exception" do
      let(:data) { stub_presenter(electives_exceptions: [stub]) }

      subject { WoopleTheme::Dashboard::ElectivesSectionPresenter.new(data) }

      specify { expect { |b| subject.render_exceptions(&b) }.to yield_control }
    end

    describe "0 elective exceptions" do
      let(:data) { stub_presenter }

      subject { WoopleTheme::Dashboard::ElectivesSectionPresenter.new(data) }

      specify { expect { |b| subject.render_exceptions(&b) }.not_to yield_control }
    end
  end

  private

  def stub_presenter(options = {})
    defaults = {enabled?: nil, electives_history: [], electives_exceptions: [], points_earned: nil, points_total: nil}
    defaults.merge!(options)

    OpenStruct.new(defaults)
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
woople-theme-0.10.0 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.9.0 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.19 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.18 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.17 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.16 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.15 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.14 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.13 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.12 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.11 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.10 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.9 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.8 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.7 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.6 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.5 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.4 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.3 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.2 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb