Permalink
Browse files

Add spec for AbstractType.included to kill mutation

  • Loading branch information...
dkubb committed Jan 19, 2013
1 parent 3ec722c commit d52d736c2058aeecb3bb3f0808c1c693a3ba08b0
Showing with 26 additions and 0 deletions.
  1. +26 −0 spec/unit/abstract_type/class_methods/included_spec.rb
@@ -0,0 +1,26 @@
# encoding: utf-8
require 'spec_helper'
describe AbstractType, '.included' do
subject { object }
let(:object) { described_class }
let(:klass) { Class.new }
it 'extends the klass' do
klass.singleton_class.should_not include(described_class::ClassMethods)
klass.send(:include, subject)
klass.singleton_class.should include(described_class::ClassMethods)
end
it 'delegates to the ancestor' do
included_ancestor = false
subject.extend Module.new {
define_method(:included) { |_| included_ancestor = true }
}
expect {
klass.send(:include, subject)
}.to change { included_ancestor }.from(false).to(true)
end
end

0 comments on commit d52d736

Please sign in to comment.