Sha256: 76c3e1a0e919671def8cd77c00ab3c9c2413a8651ea829b6fd3f6924f1e01be5
Contents?: true
Size: 1.01 KB
Versions: 14
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' module Synvert describe Rewriter::Scope do let(:source) { """ describe Post do before :each do @user = FactoryGirl.create :user end it 'gets posts' do post1 = FactoryGirl.create :post post2 = FactoryGirl.create :post end end """ } let(:node) { Parser::CurrentRuby.parse(source) } let(:instance) { double(:current_node => node, :current_node= => node, :current_source => source) } describe '#process' do it 'not call block if no matching node' do run = false scope = Rewriter::Scope.new instance, type: 'send', message: 'missing' do run = true end scope.process expect(run).to be_false end it 'call block if there is matching node' do run = false scope = Rewriter::Scope.new instance, type: 'send', receiver: 'FactoryGirl', message: 'create', arguments: [':post'] do run = true end scope.process expect(run).to be_true end end end end
Version data entries
14 entries across 14 versions & 1 rubygems