Sha256: ce62885a562878d8a0983a4c55bfc7ee2375612eecb2b1f984e62672151d3636

Contents?: true

Size: 884 Bytes

Versions: 1

Compression:

Stored size: 884 Bytes

Contents

require File.join(File.dirname(__FILE__), 'spec_helper.rb')


describe 'a volute with a :not as first arg' do

  before(:each) do

    @item = Item.new
    @invoice = Invoice.new
  end

  describe 'and classes as further args' do

    before(:each) do

      Volute.clear!

      volute :not, Item do
        object.comment = 'not an item'
      end
    end

    it 'should not affect the negated class' do

      @item.weight = '12 pounds'

      @item.comment.should == nil
    end

    it 'should affect other classes' do

      @invoice.paid = true

      @invoice.comment.should == 'not an item'
    end
  end

  describe 'and nothing else' do

    before(:each) do

      Volute.clear!

      volute :not do
        object.comment = 'NEVER !'
      end
    end

    it 'should never trigger' do

      @item.weight = '1kg'

      @item.comment.should == nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
volute-0.1.1 spec/filter_not_spec.rb