Sha256: 8e74f713953a7f616f0d8a3f1ffc6c6d3047ce8bcc508692e74e1ac8c343bc4d

Contents?: true

Size: 873 Bytes

Versions: 5

Compression:

Stored size: 873 Bytes

Contents

require 'spec_helper'

describe Nagira do 

  set :environment, ENV['RACK_ENV'] || :test

  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 
      @data.should 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
            @data[method].should be_a_kind_of Array if @data[method]
          end
          
          it "should star with slash" do
            if @data[method]
              @data[method].each do |path|
                path.should =~ /^\//
              end
            end
          end

        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nagira-0.2.9 spec/03_api_spec.rb
nagira-0.2.8 spec/03_api_spec.rb
nagira-0.2.7 spec/03_api_spec.rb
nagira-0.2.6 spec/03_api_spec.rb
nagira-0.2.5 spec/03_api_spec.rb