Sha256: 78b0a78434eb4afdaab9f3d83f24f387120efbe5657bad52eb8df76f69021d06

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require 'bundler'
Bundler.setup

require 'test/unit'
require 'minitest/spec'

require 'roar/representer/base'
require 'roar/representer/feature/hypermedia'
require 'roar/representer/feature/http_verbs'

require 'stringio'  # FIXME. remove for 3.0.4.
require 'builder'

  module TestModel
    def self.included(base)
      base.extend ClassMethods
    end
    
    
    module ClassMethods
      def accessors(*names)
        names.each do |name|
          attr_accessor name
        end
      end
    end
    
    attr_accessor :attributes
    
    def initialize(attributes={})
      attributes.each do |k,v|
        send("#{k}=", v)
      end
    end
  end


class Item
  include TestModel
  accessors :value
  
  def self.model_name
    "item"
  end
end

class Position
  include TestModel
  accessors :id, :item
  
  def self.model_name
    :order
  end
end

class Order
  include TestModel
  accessors :id, :items
  
  def self.model_name
    :order
  end
end

require "test_xml/mini_test"
require "roar/representer/xml"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
roar-0.8.2 test/test_helper.rb
roar-0.8.1 test/test_helper.rb