Sha256: e9896c0e743a50ef52380cfff5eb348938258377ad98c90cc9b9392ebc2d2a16

Contents?: true

Size: 925 Bytes

Versions: 8

Compression:

Stored size: 925 Bytes

Contents

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

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

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

    it { is_expected.to be(true) }
  end

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

    it { is_expected.to 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

8 entries across 8 versions & 1 rubygems

Version Path
mutest-0.0.9 spec/unit/mutest/ast/meta/send/proc_predicate_spec.rb
mutest-0.0.8 spec/unit/mutest/ast/meta/send/proc_predicate_spec.rb
mutest-0.0.7 spec/unit/mutest/ast/meta/send/proc_predicate_spec.rb
mutest-0.0.6 spec/unit/mutest/ast/meta/send/proc_predicate_spec.rb
mutest-0.0.5 spec/unit/mutest/ast/meta/send/proc_predicate_spec.rb
mutest-0.0.4 spec/unit/mutest/ast/meta/send/proc_predicate_spec.rb
mutest-0.0.3 spec/unit/mutest/ast/meta/send/proc_predicate_spec.rb
mutest-0.0.2 spec/unit/mutest/ast/meta/send/proc_predicate_spec.rb