Sha256: 68b5af4d9109406311f847333c58d964d0ae10f5010b1221b30067883dfae471

Contents?: true

Size: 772 Bytes

Versions: 1

Compression:

Stored size: 772 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'

describe Mutant::Subject::Method::Singleton do

  let(:object)  { described_class.new(context, node) }
  let(:context) { double }

  let(:node) do
    s(:defs, s(:self), :foo, s(:args))
  end

  describe '#prepare' do

    let(:context) do
      Mutant::Context::Scope.new(scope, double('Source Path'))
    end

    let(:scope) do
      Class.new do
        def self.foo
        end
      end
    end

    subject { object.prepare }

    it 'undefines method on scope' do
      expect { subject }.to change { scope.methods.include?(:foo) }.from(true).to(false)
    end

    it_should_behave_like 'a command method'
  end

  describe '#source' do
    subject { object.source }

    it { should eql("def self.foo\nend") }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mutant-0.5.24 spec/unit/mutant/subject/method/singleton_spec.rb