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.9.0 spec/regex_spec.rb
twitter-text-1.8.0 spec/regex_spec.rb
twitter-text-1.7.0 spec/regex_spec.rb
twitter-text-1.6.4 spec/regex_spec.rb
twitter-text-relative-1.6.2.3 spec/regex_spec.rb
twitter-text-relative-1.6.2.pre.3 spec/regex_spec.rb
twitter-text-relative-1.6.2.2 spec/regex_spec.rb
twitter-text-relative-1.6.2.1 spec/regex_spec.rb
twitter-text-1.6.3 spec/regex_spec.rb
twitter-text-1.6.2 spec/regex_spec.rb
ritter-0.0.91 spec/regex_spec.rb
ritter-0.0.90 spec/regex_spec.rb
ritter-0.0.89 spec/regex_spec.rb
ritter-0.0.88 spec/regex_spec.rb
twitter-text-editted-1.0.0 spec/regex_spec.rb
twitter-text-1.6.1 spec/regex_spec.rb
twitter-text-1.6.0 spec/regex_spec.rb
twitter-text-1.5.0 spec/regex_spec.rb
twitter-text-1.4.17 spec/regex_spec.rb
twitter-text-1.4.16 spec/regex_spec.rb