Sha256: 315d63682fede0fcfc97ac092cc434e77b761665bb96ef9af10c15b0f0c27120

Contents?: true

Size: 917 Bytes

Versions: 36

Compression:

Stored size: 917 Bytes

Contents

require 'spec_helper'

describe WoopleTheme::Dashboard::EssentialExceptionPresenter do
  describe "#title" do
    let(:data) { stub_presenter }

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

    it "should be a link to the course" do
      subject.title.should eq("<a href=\"#{subject.url}\">#{subject.name}</a>")
    end
  end

  describe "#subtitle" do
    let(:data) { stub_presenter }

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

    it "should be formatted as a reason" do
      subject.subtitle.should eq(I18n.t('woople_theme.dashboards.member.exceptions.reason', reason: subject.description))
    end
  end

  private

  def stub_presenter(options = {})
    defaults = {name: "Exception", description: "Reason", url: '/course', completed_on: Time.at(rand * Time.now.to_i)}
    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/essential_exception_presenter_spec.rb
woople-theme-0.9.0 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.19 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.18 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.17 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.16 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.15 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.14 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.13 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.12 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.11 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.10 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.9 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.8 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.7 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.6 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.5 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.4 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.3 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb
woople-theme-0.8.2 spec/presenters/woople_theme/dashboard/essential_exception_presenter_spec.rb