Sha256: a9d4260e54e225c2758c3a34fbf9771dacd571995bd57a2173baa8cc5c7a2951

Contents?: true

Size: 776 Bytes

Versions: 4

Compression:

Stored size: 776 Bytes

Contents

require 'test_helper'

class YoutubeURLStrategyTest < Test::Unit::TestCase
  def setup
    @strategy = FormattedURL::Strategies::YoutubeURLStrategy
    @url = 'http://www.youtube.com/watch?v=bNlNZ2T9EeY'
    @url2 = 'http://www.youtube.com/watch?v=XXXdDDASDFw'
  end

  def test_default_url_returns_the_same
    assert_equal(@url, @strategy.url(@url,:default))
  end

  def test_short_url
    assert_equal('http://youtu.be/bNlNZ2T9EeY', @strategy.url(@url, :short))
    assert_equal('http://youtu.be/XXXdDDASDFw', @strategy.url(@url2, :short))
  end

  def test_embed_url
    assert_equal('http://youtube.com/embed/bNlNZ2T9EeY', @strategy.url(@url, :embed))
  end

  def test_unknown_format_returns_default
    assert_equal(@url, @strategy.url(@url,:other_format))
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
formatted_url-0.0.6 test/youtube_url_strategy_test.rb
formatted_url-0.0.5 test/youtube_url_strategy_test.rb
formatted_url-0.0.4 test/youtube_url_strategy_test.rb
formatted_url-0.0.3 test/youtube_url_strategy_test.rb