Sha256: ef586bdd581606522c52a347bc98e54e390fffa501ba453303365877e8fa0982

Contents?: true

Size: 911 Bytes

Versions: 8

Compression:

Stored size: 911 Bytes

Contents

require "spec_helper"

describe Apipie::MethodDescription do

  let(:dsl_data) { ActionController::Base.send(:_apipie_dsl_data_init) }

  describe "params descriptions" do

    before(:each) do
      @resource = Apipie::ResourceDescription.new(ApplicationController, "dummy")
      dsl_data[:params] = [[:a, String, nil, {}, nil],
                           [:b, String, nil, {}, nil],
                           [:c, String, nil, {}, nil]]
      @method = Apipie::MethodDescription.new(:a, @resource, dsl_data)
      @resource.add_method_description @method
    end

    it "should be ordered" do
      @method.params.keys.should == [:a, :b, :c]
      @method.to_json[:params].map{|h| h[:name]}.should == ['a', 'b', 'c']
    end

    it "should be still ordered" do
      @method.params.keys.should == [:a, :b, :c]
      @method.to_json[:params].map{|h| h[:name]}.should == ['a', 'b', 'c']
    end

  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
apipie-rails-0.0.24 spec/lib/method_description_spec.rb
apipie-rails-0.0.23 spec/lib/method_description_spec.rb
jmoses_apipie-rails-0.0.23 spec/lib/method_description_spec.rb
apipie-rails-0.0.22 spec/lib/method_description_spec.rb
apipie-rails-0.0.21 spec/lib/method_description_spec.rb
apipie-rails-0.0.20 spec/lib/method_description_spec.rb
apipie-rails-0.0.19 spec/lib/method_description_spec.rb
apipie-rails-0.0.18 spec/lib/method_description_spec.rb