Sha256: 27b8f74c33b38308684ccc35971906c8bf6ec86f1551f25ba771c6ce04da9554

Contents?: true

Size: 763 Bytes

Versions: 5

Compression:

Stored size: 763 Bytes

Contents

require 'spec_helper'

describe Mutant::Context::Scope, '.build' do
  subject { described_class.build(constant, path) }

  let(:object)  { described_class }
  let(:context) { mock('Context') }
  let(:path)    { mock('Path')    }

  context 'when constant is a module' do
    let(:constant) { Module.new }

    it { should be_kind_of(described_class::Module) }
  end

  context 'when constant is a class' do
    let(:constant) { Class.new }

    it { should be_kind_of(described_class::Class) }
  end

  context 'when constant is not a class nor a module' do
    let(:constant) { Object.new }

    it 'should raise error' do
      expect { subject }.to raise_error(ArgumentError, 'Can only build mutation scope from class or module got: Object')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mutant-0.2.4 spec/unit/mutant/context/scope/class_methods/build_spec.rb
mutant-0.2.3 spec/unit/mutant/context/scope/class_methods/build_spec.rb
mutant-0.2.2 spec/unit/mutant/context/scope/class_methods/build_spec.rb
mutant-0.2.1 spec/unit/mutant/context/scope/class_methods/build_spec.rb
mutant-0.2.0 spec/unit/mutant/context/scope/class_methods/build_spec.rb