Sha256: e9f910ae59b0de9db44eb3fbe30976bb37c9074b81429363d39b4011ebce9fe4

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require File.join(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__)))), 'spec_helper')
require File.join(File.dirname(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__))))), 'lib', 'reek', 'core', 'block_context')
require File.join(File.dirname(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__))))), 'lib', 'reek', 'core',  'method_context')

include Reek::Core

describe BlockContext do
  context 'full_name' do
    it "reports full context" do
      bctx = BlockContext.new(StopContext.new, s(nil, nil))
      bctx.full_name.should == 'block'
    end
    it 'uses / to connect to the class name' do
      element = StopContext.new
      element = ClassContext.new(element, :Fred, s(:class, :Fred))
      element = BlockContext.new(element, s(:iter, nil, s(:lasgn, :x), nil))
      element.full_name.should == 'Fred/block'
    end
    it 'uses / to connect to the module name' do
      element = StopContext.new
      element = ModuleContext.new(element, :Fred, s(:module, :Fred))
      element = BlockContext.new(element, s(:iter, nil, s(:lasgn, :x), nil))
      element.full_name.should == 'Fred/block'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reek-1.2.7.1 spec/reek/core/block_context_spec.rb
reek-1.2.7 spec/reek/core/block_context_spec.rb