Sha256: 6285011010a56169597eb28dba80739ca734b2d400b310ac664617cfd5431dea

Contents?: true

Size: 991 Bytes

Versions: 24

Compression:

Stored size: 991 Bytes

Contents

require 'spec_helper'
require 'sinatra'
require 'helpers'


describe "helpers" do
  include_context :resources

  before :each do
    @helper = Object.new
    @helper.extend(Mirage::Server::Helpers)
  end

  describe 'converting raw parameter requirements' do
    it 'should split on split on the (:) to derive the required parameter and value' do
      @helper.convert_raw_required_params(%w(name:leon)).should == {'name' => 'leon'}
    end

    it 'should store regular expression matcher' do
      @helper.convert_raw_required_params(%w(name:%r{.*eon})).should == {'name' => /.*eon/}
    end
  end

  describe 'converting raw body content requirements' do
    it 'should extract plan text requirements' do
      @helper.convert_raw_required_body_content_requirements(%w(leon)).should == %w(leon)
    end

    it 'should extract plan requirements in the form of a regexp' do
      @helper.convert_raw_required_body_content_requirements(%w(%r{.*eon})).should == [/.*eon/]
    end
  end

end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
mirage-3.0.0.alpha.4 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.3 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.2 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.1 spec/server/helpers_spec.rb