Sha256: 39dd41dfca6bc93214d61dd1764e0b48e1a59344be5ee70fd17bab798b894b8e

Contents?: true

Size: 929 Bytes

Versions: 16

Compression:

Stored size: 929 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Mutant::AST::Meta::Send, '#proc?' do
  subject { described_class.new(node).proc? }

  shared_context 'proc send' do |source|
    let(:node) { Unparser.parse(source).children.first }
  end

  shared_examples 'proc definition' do |*args|
    include_context 'proc send', *args

    it { should be(true) }
  end

  shared_examples 'not a proc definition' do |*args|
    include_context 'proc send', *args

    it { should be_falsey }
  end

  it_behaves_like 'proc definition', 'proc { }'
  it_behaves_like 'proc definition', 'Proc.new { }'
  it_behaves_like 'not a proc definition', 'new { }'
  it_behaves_like 'not a proc definition', 'foo.proc { }'
  it_behaves_like 'not a proc definition', 'Proc.blah { }'
  it_behaves_like 'not a proc definition', 'Proc().new { }'
  it_behaves_like 'not a proc definition', 'Foo.new { }'
  it_behaves_like 'not a proc definition', 'blah { }'
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mutant-0.9.11 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.9.10 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.9.9 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.9.8 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.9.7 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.9.6 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.9.5 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.9.4 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.9.3 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.9.2 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.9.1 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.9.0 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.8.24 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.8.23 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.8.22 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
mutant-0.8.21 spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb