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
twitter-text-1.4.15 spec/regex_spec.rb
twitter-text-1.4.14 spec/regex_spec.rb
twitter-text-1.4.13 spec/regex_spec.rb
twitter-text-1.4.12 spec/regex_spec.rb
twitter-text-1.4.11 spec/regex_spec.rb
twitter-text-1.4.10 spec/regex_spec.rb
twitter-text-1.4.9 spec/regex_spec.rb
twitter-text-1.4.8 spec/regex_spec.rb
twitter-text-1.4.7 spec/regex_spec.rb
twitter-text-1.4.6 spec/regex_spec.rb
twitter-text-1.4.5 spec/regex_spec.rb
twitter-text-1.3.4 spec/regex_spec.rb
twitter-text-1.3.3 spec/regex_spec.rb
twitter-text-1.3.2 spec/regex_spec.rb
twitter-text-1.4.2 spec/regex_spec.rb
twitter-text-1.4.1 spec/regex_spec.rb
twitter-text-1.3.1 spec/regex_spec.rb
twitter-text-1.3.0 spec/regex_spec.rb
twitter-text-1.2.5 spec/regex_spec.rb
twitter-text-1.2.4 spec/regex_spec.rb