Sha256: 114610af19a27e18a85bde4543128223712f9bb96fdc276e3997f66c79e85d74

Contents?: true

Size: 845 Bytes

Versions: 4

Compression:

Stored size: 845 Bytes

Contents

require 'spec_helper'

#
# Test resonse to /_api GET
#
describe Nagira do

  include Rack::Test::Methods

  def app
    @app ||= Nagira
  end



  context "API data" do
    before :all do
      get "/_api.json"
      @data = JSON.parse last_response.body
    end

    it "should be array" do
      expect(@data).to be_a_kind_of Hash
    end

    METHODS = %w{ GET PUT POST DELETE}

    context "routes" do

      METHODS.each do |method|

        context method do
          it "routes should be an Array" do
            expect(@data[method]).to be_a_kind_of Array if @data[method]
          end

          it "should star with slash" do
            if @data[method]
              @data[method].each do |path|
                expect(path).to match( /^\//)
              end
            end
          end

        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nagira-0.5.1 spec/01_data_format/03_api_spec.rb
nagira-0.5.0 spec/01_data_format/03_api_spec.rb
nagira-0.4.2 spec/01_data_format/03_api_spec.rb
nagira-0.4.1 spec/01_data_format/03_api_spec.rb