Sha256: 8b1a87aecc5e6dcccf329d8b3210196486db65704f6778cac193e06d41c3068d
Contents?: true
Size: 1.07 KB
Versions: 4
Compression:
Stored size: 1.07 KB
Contents
require 'minitest/autorun' require 'ostruct' require 'roar/representer' require 'roar/representer/feature/http_verbs' require 'roar/representer/json/hal' module AttributesConstructor # TODO: remove me. def initialize(attrs={}) attrs.each do |k,v| instance_variable_set("@#{k}", v) end end end # FIXME: provide a real #== for OpenStruct. class Song < OpenStruct def ==(other) name == other.name and track == other.track end end class Album < OpenStruct end require "test_xml/mini_test" require "roar/representer/xml" require "integration/runner" MiniTest::Spec.class_eval do def link(options) Roar::Representer::Feature::Hypermedia::Hyperlink.new(options) end def self.representer_for(modules=[Roar::Representer::JSON, Roar::Representer::Feature::Hypermedia], &block) let (:rpr) do Module.new do include *modules.reverse module_exec(&block) end end end def self.representer!(*args, &block) representer_for(*args, &block) end def self.verbs(&block) %w(get post put delete).each(&block) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
roar-0.12.9 | test/test_helper.rb |
roar-0.12.8 | test/test_helper.rb |
roar-0.12.7 | test/test_helper.rb |
roar-0.12.6 | test/test_helper.rb |