Permalink
Browse files

Add CardBehaviour with ::behaviours

  • Loading branch information...
1 parent f200cd3 commit f0c014be31c91c54a5cffd72744e411a813adb8a @calebthompson committed Jul 4, 2012
View
@@ -20,5 +20,5 @@ Gem::Specification.new do |s|
# specify any dependencies here; for example:
s.add_development_dependency "rspec"
- # s.add_runtime_dependency "rest-client"
+ s.add_dependency 'activesupport'
end
View
@@ -1,4 +1,5 @@
-require "demesne/version"
+require_relative "./demesne/version"
+require_relative "./demesne/behaviours"
module Demesne
# Your code goes here...
@@ -0,0 +1,4 @@
+require_relative "./behaviours/card_behaviour"
+
+module Demesne::Behaviours
+end
@@ -0,0 +1,13 @@
+require 'active_support/concern'
+
+module Demesne::Behaviours
+ module CardBehaviour
+ extend ActiveSupport::Concern
+
+ module ClassMethods
+ def behaviours
+ []
+ end
+ end
+ end
+end
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+describe Demesne::Behaviours::CardBehaviour do
+ before do
+ @test_card = class TestCard
+ include Demesne::Behaviours::CardBehaviour
+ end
+ end
+
+ subject { @test_card }
+
+ it { should respond_to(:behaviours) }
+ describe "::behaviours" do
+ subject { @test_card.behaviours }
+ it { should eq([]) }
+ end
+end
View
@@ -5,6 +5,7 @@
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
+ require_relative "../lib/demesne.rb"
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus

0 comments on commit f0c014b

Please sign in to comment.