Sha256: ab49fd339c380910cff881298f9d3eebdc54508beea0894239e6e817ab1153e4

Contents?: true

Size: 802 Bytes

Versions: 1

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

require "test_helper"

module SocialUrl
  class TwitterTest < Minitest::Test
    def setup
      @options = {
        text: "Hello World",
        url: "http://example.com",
        hashtags: ["nature", "sunset", "Multi Word HashTag"],
        via: "twitterdev",
        related: ["twitter:Twitter News", "twitterapi:Twitter API News"]
      }
    end

    def test_url
      opts = SocialUrl.normalize(@options)
      url = ["https://twitter.com/intent/tweet/?text=Hello%20World",
             "&url=http%3A%2F%2Fexample.com",
             "&hashtags=nature,sunset,MultiWordHashTag",
             "&via=twitterdev",
             "&related=twitter%3ATwitter%20News,twitterapi%3ATwitter%20API%20News"].join

      assert_equal url, Twitter.new(opts).url
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
social-url-1.1.1 test/lib/social_url/twitter_test.rb