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.8.1 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.8.0 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.27 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.26 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.25 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.24 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.23 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.22 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.21 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.20 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.19 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.18 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.17 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.14 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.13 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb
woople-theme-0.6.12 spec/presenters/woople_theme/dashboard/electives_section_presenter_spec.rb