Sha256: 430ad4c28da388442cc24f7ad703acde1871db8be751f8e03793dfa0660758d0

Contents?: true

Size: 802 Bytes

Versions: 17

Compression:

Stored size: 802 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'

describe Mutant::Subject::Method::Singleton do
  include Mutant::NodeHelpers

  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

17 entries across 17 versions & 1 rubygems

Version Path
mutant-0.5.23 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.22 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.21 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.20 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.19 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.18 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.17 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.16 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.15 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.14 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.13 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.12 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.11 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.10 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.9 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.8 spec/unit/mutant/subject/method/singleton_spec.rb
mutant-0.5.7 spec/unit/mutant/subject/method/singleton_spec.rb