Sha256: 17fd195c76deb6aaef8eb514c1579c3be5ded06cd6d01f8bda847975034d2ba8

Contents?: true

Size: 714 Bytes

Versions: 3

Compression:

Stored size: 714 Bytes

Contents

require 'spec_helper'
require 'roar_extensions'

describe Roar::Representer::JSON::HAL do
  describe "Hypermedia Feature" do
    describe "Hypermedia.link" do
      let(:mod) do
        Module.new do
          include Roar::Representer::JSON
          include Roar::Representer::Feature::Hypermedia

          link :rel => 'self', :title => "Hey, @myabc" do
            "http://self"
          end
        end
      end

      it "accepts strings for rel" do
        Object.new.extend(mod).to_hash['links'][0]['rel'].should == 'self'
      end

      it "returns string keys" do
        Object.new.extend(mod).to_hash['links'][0].keys.sort.
          should == ['href', 'rel', 'title']
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
roar-extensions-0.1.0 spec/roar/representer/feature/hypermedia_spec.rb
roar-extensions-0.0.4 spec/roar/representer/feature/hypermedia_spec.rb
roar-extensions-0.0.3 spec/roar/representer/feature/hypermedia_spec.rb