Sha256: b02def304cbe6e1fa2788c60d26e940b476b6320a260c01b751366de65d9ab7f

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe WoopleTheme::VideoPresenter do
  subject { WoopleTheme::VideoPresenter.new(stub_presenter) }

  describe '#favorite_css_class' do
    it "returns 'active' when favorited" do
      subject.stub favorite?: true
      subject.favorite_css_class.should eq 'active'
    end

    it 'returns nothing when unfavorited' do
      subject.stub favorite?: false
      subject.favorite_css_class.should eq ''
    end
  end

  describe "#liked_css" do
    it "returns nothing" do
      subject.liked_css.should be_nil
    end

    it "returns 'active' when liked" do
      subject.stub(:liked?) { true }

      subject.liked_css.should eq('active')
    end

    it "returns nil when not liked" do
      subject.stub(:liked?) { false }

      subject.liked_css.should be_nil
    end
  end

  describe "#disliked_css" do
    it "returns nothing" do
      subject.disliked_css.should be_nil
    end

    it "returns 'active' when disliked" do
      subject.stub(:liked?) { false }

      subject.disliked_css.should eq('active')
    end

    it "returns nil when liked" do
      subject.stub(:liked?) { true }

      subject.disliked_css.should be_nil
    end
  end

  private

  def stub_presenter(options = {})
    defaults = {name: nil, desktop_src: nil, mobile_src: nil, streamer: nil, favorite?: nil, liked?: nil}
    defaults.merge!(options)

    OpenStruct.new(defaults)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
woople-theme-0.8.1 spec/presenters/video_presenter_spec.rb
woople-theme-0.8.0 spec/presenters/video_presenter_spec.rb