Sha256: 02dcaaa4e80e97c45e0591e23e24b5c1abbf0162ff861ea4e306333c50374b3c

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'
require 'embeddable/view_helpers'

describe Embeddable::ViewHelpers do
  subject { Dummy.new }

  class HelperDummy
    include Embeddable::ViewHelpers

    def link_to(*args)
      true
    end
  end

  before do
    @helper = HelperDummy.new
  end

  describe 'embed_video' do
    context 'specifying embeddable name' do
      it 'should use the name provided' do
        expect(@helper).to receive(:link_to)
        @helper.embed_video(subject, '100%', '100%', name: :super_video)
      end

      it 'should raise error if the provided name is wrong' do
        expect do
          @helper.embed_video(subject, '100%', '100%', name: :wrong_name)
        end.to raise_error
      end
    end

    context 'not specifying embeddable name' do
      it 'should choose the first embeddable name' do
        expect(@helper).to receive(:render_embeddable_partial).
          with(subject, :video, :video_url, '100%', '100%')
        @helper.embed_video(subject, '100%', '100%')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
embeddable-0.0.8 spec/lib/embeddable/view_helpers_spec.rb