Sha256: 47d45bc5fce88832ce15bc5774efdd14e68c4a404e1debcb6f8ae3ccb20cb904

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'
module Sexpr::Matcher
  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

5 entries across 5 versions & 1 rubygems

Version Path
sexpr-0.6.0 spec/unit/matcher/terminal/test_match_q.rb
sexpr-0.5.1 spec/matcher/terminal/test_match_q.rb
sexpr-0.5.0 spec/matcher/terminal/test_match_q.rb
sexpr-0.4.0 spec/matcher/terminal/test_match_q.rb
sexpr-0.3.0 spec/matcher/terminal/test_match_q.rb