Sha256: 60872bc071e8f903d2997b53f2ebd03797feb6adf68de712fb5133190755240d

Contents?: true

Size: 1.39 KB

Versions: 20

Compression:

Stored size: 1.39 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_id: nil, favorite?: nil, liked?: nil}
    defaults.merge!(options)

    OpenStruct.new(defaults)
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

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