Sha256: c4909d061d3366524d47bc86c95ebed8fdbd5c58845064970fa1b32c08c8cefa

Contents?: true

Size: 719 Bytes

Versions: 3

Compression:

Stored size: 719 Bytes

Contents

require 'test_helper'
require "dummy/config/environment"
require 'roar/rails'

module Representer
  module JPG
    class Song; end
    class Album < Roar::Representer::XML; end
  end
end



class RailsRepresenterMethodsTest < MiniTest::Spec
  describe "Rails::RepresenterMethods" do
    before do
      @c = Representer::JPG::Album  # TODO: mix Rails into Base, not XML only.
    end

    it "provides conventions for #collection" do
      @c.collection :songs

      @d = @c.representable_attrs.first
      assert_equal Representer::JPG::Song, @d.sought_type
      assert @d.array?
    end

    it "provides conventions for #representation_name" do
      assert_equal "album", @c.representation_name
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
roar-0.11.7 test/rails/rails_representer_methods_test.rb
roar-0.11.6 test/rails/rails_representer_methods_test.rb
roar-0.11.5 test/rails/rails_representer_methods_test.rb