Sha256: 2b37cd62efe46accf63e191f9cfa40656541dc262b1888373cfd1973ba3eb1d4

Contents?: true

Size: 791 Bytes

Versions: 8

Compression:

Stored size: 791 Bytes

Contents

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

  def parse(source)
    Parser::CurrentRuby.parse(source)
  end

  context 'when implicit top level const' do
    let(:node) { parse('Foo.bar') }

    it { is_expected.to be true }
  end

  context 'when cbase' do
    let(:node) { parse('::Foo.bar') }

    it { is_expected.to be true }
  end

  context 'when nested const' do
    let(:node) { parse('Baz::Foo.bar') }

    it { is_expected.to be false }
  end

  context 'when no receiver' do
    let(:node) { parse('bar') }

    it { is_expected.to be false }
  end

  context 'when send receiver' do
    let(:node) { parse('foo.bar') }

    it { is_expected.to be false }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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