Sha256: deaa8fe5f36345981c8be2b0a40c99b6f248ed2d95100b6284fa14d532f184f1

Contents?: true

Size: 1.09 KB

Versions: 66

Compression:

Stored size: 1.09 KB

Contents

# encoding: utf-8
require File.dirname(__FILE__) + '/spec_helper'

describe "Twitter::Regex regular expressions" do
  describe "matching URLS" do
    TestUrls::VALID.each do |url|
      it "should match the URL #{url}" do
        url.should match_autolink_expression
      end

      it "should match the URL #{url} when it's embedded in other text" do
        text = "Sweet url: #{url} I found. #awesome"
        url.should match_autolink_expression_in(text)
      end
    end
  end

  describe "invalid URLS" do
    it "does not link urls with invalid characters" do
      TestUrls::INVALID.each {|url| url.should_not match_autolink_expression}
    end
  end

  describe "matching List names" do
    it "should match if less than 25 characters" do
      name = "Shuffleboard Community"
      name.length.should < 25
      name.should match(Twitter::Regex::REGEXEN[:list_name])
    end

    it "should not match if greater than 25 characters" do
      name = "Most Glorious Shady Meadows Shuffleboard Community"
      name.length.should > 25
      name.should match(Twitter::Regex[:list_name])
    end

  end
end

Version data entries

66 entries across 64 versions & 5 rubygems

Version Path
tdiary-5.0.8 vendor/bundle/gems/twitter-text-1.14.7/spec/regex_spec.rb
twitter-text-1.14.7 spec/regex_spec.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/twitter-text-1.14.5/spec/regex_spec.rb
tdiary-5.0.5 vendor/bundle/gems/twitter-text-1.14.5/spec/regex_spec.rb
tdiary-5.0.5 vendor/bundle/gems/twitter-text-1.14.6/spec/regex_spec.rb
twitter-text-1.14.6 spec/regex_spec.rb
tdiary-5.0.4 vendor/bundle/gems/twitter-text-1.14.5/spec/regex_spec.rb
twitter-text-1.14.5 spec/regex_spec.rb
twitter-text-1.14.2 spec/regex_spec.rb
twitter-text-1.14.1 spec/regex_spec.rb
twitter-text-1.14.0 spec/regex_spec.rb
twitter-text-1.13.4 spec/regex_spec.rb
twitter-text-1.13.3 spec/regex_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/twitter-text-1.13.0/spec/regex_spec.rb
twitter-text-1.13.0 spec/regex_spec.rb
twitter-text-1.12.0 spec/regex_spec.rb
twitter-text-1.11.0 spec/regex_spec.rb
twitter-text-1.10.0 spec/regex_spec.rb
twitter-text-1.9.2 spec/regex_spec.rb
twitter-text-1.9.1 spec/regex_spec.rb