Sha256: 7ef14e373a4182ac02e82007e71164e58c9b5cdb9efc5bf1ceda39bfed927700

Contents?: true

Size: 751 Bytes

Versions: 11

Compression:

Stored size: 751 Bytes

Contents

RSpec.describe Mutant::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 { should be true }
  end

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

    it { should be true }
  end

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

    it { should be false }
  end

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

    it { should be false }
  end

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

    it { should be false }
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mutant-0.8.16 spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
mutant-0.8.15 spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
mutant-0.8.14 spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
mutant-0.8.13 spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
mutant-0.8.12 spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
mutant-0.8.11 spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
mutant-0.8.10 spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
mutant-0.8.9 spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
mutant-0.8.8 spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
mutant-0.8.7 spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
mutant-0.8.6 spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb