Sha256: dc82fe01ce6f416292ed32dfd3cf677351291d6cad80a2766582cd88c95163bf

Contents?: true

Size: 523 Bytes

Versions: 2

Compression:

Stored size: 523 Bytes

Contents

require 'spec_helper'

describe 'NotRewriter' do
  include TrackNots, DoRewrite

  before :each do
    @not_user = NotUser.new true  
    @methods = sexpify_instance_methods NotUser
    @not_rewriter = VirtualKeywords::NotRewriter.new

    @my_not_calls = 0

    VirtualKeywords::REWRITTEN_KEYWORDS.register_lambda_for_object(
        @not_user, :not, my_not)
  end

  def rewriters
    [@not_rewriter]
  end

  it 'rewrites "not" expressions' do
    do_rewrite(:negate, @not_user)
    @my_not_calls.should eql 1
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
virtual_keywords-0.3.1 lib/spec/not_rewriter_spec.rb
virtual_keywords-0.3.0 lib/spec/not_rewriter_spec.rb