Skip to content

Commit

Permalink
added a few tests for included_modules
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://rubyforge.org/var/svn/mixology/trunk@6 62817f43-b31e-4560-8c3d-5e0e681460fe
  • Loading branch information
dan-manges committed Aug 17, 2007
1 parent 66e7d4a commit c6d398f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
4 changes: 1 addition & 3 deletions Rakefile
Expand Up @@ -3,8 +3,6 @@ require 'rake/clean'
require 'rake/gempackagetask'
require "rake/testtask"

ARCHLIB = "lib/#{::Config::CONFIG['arch']}"

task :default => %w[clean compile test]

Rake::TestTask.new("test") do |t|
Expand Down Expand Up @@ -34,7 +32,7 @@ Gem::manage_gems

specification = Gem::Specification.new do |s|
s.name = "mixology"
s.summary = "Mixology enables objects to mix and unmix modules."
s.summary = "Mixology enables objects to mixin and unmix modules."
s.version = "0.1.0"
s.author = "Pat Farley, Z, Dan Manges"
s.description = s.summary
Expand Down
26 changes: 26 additions & 0 deletions test/mixology_test.rb
Expand Up @@ -59,5 +59,31 @@ def test_can_add_mod_to_an_instance_even_when_already_included_by_class
object.mixin mixin
assert_equal "mixin", object.foo
end

def test_included_modules_after_mixin
mixin = Module.new
object = Object.new
object.mixin mixin
assert_equal [mixin, Mixable, Kernel], (class << object; self; end).included_modules
end

def test_included_modules_after_unmix
mixin = Module.new
object = Object.new
object.mixin mixin
object.unmix mixin
assert_equal [Mixable, Kernel], (class << object; self; end).included_modules
end

def test_included_modules_after_remix
mixin_one = Module.new
mixin_two = Module.new
object = Object.new
object.mixin mixin_one
object.mixin mixin_two
assert_equal [mixin_two, mixin_one, Mixable, Kernel], (class << object; self; end).included_modules
object.mixin mixin_one
assert_equal [mixin_one, mixin_two, Mixable, Kernel], (class << object; self; end).included_modules
end

end

0 comments on commit c6d398f

Please sign in to comment.