Sha256: d99c31afc2446ae771e5b17622490d2f18d50c1a405da7b2ebdf2d8372227bfa

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

# coding: utf-8

require 'test_helper'

include IRCSupport::Validations

describe "ValidNickname" do
  it "should say the nick is valid" do
    valid_nickname?("foobar[^]").must_equal true
    valid_nickname?("Foobar^1").must_equal true
    valid_nickname?("Fo{}o[]ba\\r-^1").must_equal true
  end
  it "should say the nick is invalid" do
    valid_nickname?("foobar[=]").must_equal false
    valid_nickname?("0Foobar^1").must_equal false
  end
end

describe "ValidChannelName" do
  it "should say the channel is valid" do
    valid_channel_name?("#fooBARæði123...iii").must_equal true
    valid_channel_name?("#foobar").must_equal true
    valid_channel_name?("#foo.bar").must_equal true
    valid_channel_name?("&foobar").must_equal true
    valid_channel_name?("-foobar", [ :- ]).must_equal true
  end
  it "should say the channel is invalid" do
    valid_channel_name?("#foo,bar").must_equal false
    valid_channel_name?("dfdsfdsf").must_equal false
    valid_channel_name?("-dfdsfdsf").must_equal false
    valid_channel_name?("#foobar", [ :k ]).must_equal false
    valid_channel_name?("#chan"+"f"*200).must_equal false
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ircsupport-0.2.0 test/validations_test.rb
ircsupport-0.1.0 test/validations_test.rb