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.6 spec/server/helpers_spec.rb
mirage-3.0.5 spec/server/helpers_spec.rb
mirage-3.0.4 spec/server/helpers_spec.rb
mirage-3.0.3 spec/server/helpers_spec.rb
mirage-3.0.2 spec/server/helpers_spec.rb
mirage-3.0.1 spec/server/helpers_spec.rb
mirage-3.0.0 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.17 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.16 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.15 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.14 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.13 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.12 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.11 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.10 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.9 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.8 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.7 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.6 spec/server/helpers_spec.rb
mirage-3.0.0.alpha.5 spec/server/helpers_spec.rb