Sha256: bc58a244531e2c4505cf4342d0fca61364616fcda92a53dfdae1fc2f44e0b162

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'
module Sexpr
  describe Terminal, "match?" do

    let(:rule){ Terminal.new(arg) }

    describe "with true" do
      let(:arg){ true }

      it 'returns true on match' do
        rule.should be_match(true)
        (rule === true).should be_true
      end

      it 'returns false on no match' do
        rule.should_not be_match([])
        rule.should_not be_match(nil)
        rule.should_not be_match(false)
      end

    end

    describe "with false" do
      let(:arg){ false }

      it 'returns true on match' do
        rule.should be_match(false)
        (rule === false).should be_true
      end

      it 'returns false on no match' do
        rule.should_not be_match([])
        rule.should_not be_match(nil)
        rule.should_not be_match(true)
      end

    end

    describe "with nil" do
      let(:arg){ nil }

      it 'returns true on match' do
        rule.should be_match(nil)
        (rule === nil).should be_true
      end

      it 'returns false on no match' do
        rule.should_not be_match([])
        rule.should_not be_match(false)
        rule.should_not be_match(true)
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sexpr-0.2.0 spec/terminal/test_match_q.rb