Skip to content

Instantly share code, notes, and snippets.

@marocchino
Created May 22, 2013 01:12
Show Gist options
  • Save marocchino/5624554 to your computer and use it in GitHub Desktop.
Save marocchino/5624554 to your computer and use it in GitHub Desktop.
included 타이밍에 변경한걸 되돌리기 힘들어서 결국 매번 새로만들기로 했어요.
module Yahoo
self.included(base)
base.messages << :yahoo
end
end
require 'spec_helper'
describe Yahoo do
let(:yahoo_included_test_object) do
class_with(Yahoo).new
end
let(:test_object) do
TestBase.new
end
it { yahoo_included_test_object.class.messages.should include(:yahoo)}
it { test_object.class.messages.should_not include(:yahoo)}
end
class TestBase
def self.messages
@messages ||= []
end
end
def class_with(*modules)
Class.new(TestBase) do
include modules
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment