Sha256: d58206e125caaec8b6dd276f66690d7a906e6adf92ae93941133ba394addf8fd

Contents?: true

Size: 1.45 KB

Versions: 19

Compression:

Stored size: 1.45 KB

Contents

require "spec_helper"

describe Apipie::Application do

  describe "api_controllers_paths" do
    before { Apipie.configuration.api_controllers_matcher = [File.join(Rails.root, "app", "controllers", "**","*.rb"), File.join(Rails.root, "lib", "**","*.rb")] }

    it "should support receiving array as parameter" do
      expect { Apipie.api_controllers_paths}.
        not_to raise_error
    end


  end

  describe "get_resource_name" do
    subject {Apipie.get_resource_name(Api::V2::Nested::ArchitecturesController)}

    context "with namespaced_resources enabled" do
      before { Apipie.configuration.namespaced_resources = true }
      context "with a defined base url" do
        
        it "should not overwrite the parent resource" do
          should_not eq(Apipie.get_resource_name(Api::V2::ArchitecturesController))
        end
        
      end

      context "with an undefined base url" do
        before {Apipie.app.stub(:get_base_url) { nil }}

        it "should not raise an error" do
          expect { Apipie.get_resource_name(Api::V2::ArchitecturesController) }.
            not_to raise_error
        end
      end

      after { Apipie.configuration.namespaced_resources = false }
    end

    context "with namespaced_resources enabled" do
      before { Apipie.configuration.namespaced_resources = false }

      it "should overwrite the the parent" do
        should eq(Apipie.get_resource_name(Api::V2::ArchitecturesController))
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
apipie-rails-0.3.5 spec/lib/application_spec.rb
apipie-rails-0.3.4 spec/lib/application_spec.rb
apipie-rails-0.3.3 spec/lib/application_spec.rb
apipie-rails-0.3.2 spec/lib/application_spec.rb
apipie-rails-0.3.1 spec/lib/application_spec.rb
apipie-rails-0.3.0 spec/lib/application_spec.rb
apipie-rails-0.2.6 spec/lib/application_spec.rb
apipie-rails-0.2.5 spec/lib/application_spec.rb
apipie-rails-0.2.4 spec/lib/application_spec.rb
apipie-rails-0.2.3 spec/lib/application_spec.rb
apipie-rails-0.2.2 spec/lib/application_spec.rb
apipie-rails-0.2.1 spec/lib/application_spec.rb
apipie-rails-0.2.0 spec/lib/application_spec.rb
apipie-rails-0.1.3 spec/lib/application_spec.rb
apipie-rails-0.1.2 spec/lib/application_spec.rb
apipie-rails-0.1.1 spec/lib/application_spec.rb
apipie-rails-0.1.0 spec/lib/application_spec.rb
apipie-rails-0.0.24 spec/lib/application_spec.rb
apipie-rails-0.0.23 spec/lib/application_spec.rb