Sha256: aa41351624dfaf46397594108c0f19e69a3ac9990a9cb319150cc6b5fb7d6f33

Contents?: true

Size: 866 Bytes

Versions: 2

Compression:

Stored size: 866 Bytes

Contents

# coding: utf-8

require 'test_helper'

include IRCSupport::Modes

describe "Modelines" do
  it "should condense the mode line" do
    condense_modes('+o-v-o-o+v-o+o+o').must_equal '+o-voo+v-o+oo'
  end

  it "should generate the mode changes" do
    diff_modes('ailowz','i').must_equal '-alowz'
    diff_modes('i','ailowz').must_equal '+alowz'
    diff_modes('i','alowz').must_equal '-i+alowz'
  end

  it "should parse the modes" do
    parse_modes('+i-m').must_equal [
      { set: true, mode: 'i' },
      { set: false, mode: 'm' },
    ]
    parse_channel_modes(['+i+k+l', 'secret', '5']).must_equal [
      { set: true, mode: 'i' },
      { set: true, mode: 'k', argument: 'secret' },
      { set: true, mode: 'l', argument: 5 },
    ]
  end

  it "should fail to parse the modes" do
    proc { parse_channel_modes('+i-_')}.must_raise ArgumentError
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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