spec/bacon_helper.rb in caricature-0.6.3 vs spec/bacon_helper.rb in caricature-0.7.0

- old
+ new

@@ -5,20 +5,17 @@ # adds the path to the caricature library. $: << File.dirname(__FILE__) + "/../lib" # load the caricature library require "caricature" -require 'caricature/clr' +require 'rubygems' # load the bacon library require 'bacon' -# Add the .NET framework -require 'mscorlib' - # load the assembly with the C# code -load_assembly 'ClrModels' +require 'ClrModels.dll' if defined? IRONRUBY_VERSION class Soldier def initialize @life = 10 @@ -103,46 +100,69 @@ def self.good_bye_world "Goodbye world!" end +end + +class Sheath + attr_reader :dagger + + def initialize(dagger) + @dagger = dagger + end + + def insert(dagger) + raise "There is already a dagger in here" if @dagger + @dagger = dagger + end + + def draw + raise "Dagger is nowhere to be found" unless @dagger + d = @dagger + @dagger = nil + d + end end -module Caricature +if defined? IRONRUBY_VERSION - module InterfaceIncludingModule - include ClrModels::IWarrior - end + module Caricature - module PureRubyModule + module InterfaceIncludingModule + include ClrModels::IWarrior + end + + module PureRubyModule - end + end - module RubyModuleIncludingModule - include PureRubyModule - end + module RubyModuleIncludingModule + include PureRubyModule + end - module InterfaceUpTheWazoo - include InterfaceIncludingModule - end + module InterfaceUpTheWazoo + include InterfaceIncludingModule + end - class InterfaceIncludingClass - include ClrModels::IWarrior - end + class InterfaceIncludingClass + include ClrModels::IWarrior + end - class SubClassingClrClass < ClrModels::Ninja + class SubClassingClrClass < ClrModels::Ninja - end + end - class InterfaceUpTheWazooClass - include InterfaceUpTheWazoo - end + class InterfaceUpTheWazooClass + include InterfaceUpTheWazoo + end - class SubclassingRubyClass < Soldier + class SubclassingRubyClass < Soldier - end + end - class ModuleIncludingClass - include RubyModuleIncludingModule + class ModuleIncludingClass + include RubyModuleIncludingModule + end end -end +end \ No newline at end of file