Sha256: ae38c061f80a24b42d1698b8af207089bb13c30d3d662e5e7d3f72f0167db638

Contents?: true

Size: 1.19 KB

Versions: 14

Compression:

Stored size: 1.19 KB

Contents

#          Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require File.expand_path('../../../../spec/helper', __FILE__)

describe 'Controller::generate_mapping' do
  def gen(klass)
    Ramaze::Controller::generate_mapping(klass)
  end

  it 'maps ::ClassController to /class' do
    gen('ClassController').should == '/class'
  end

  it 'maps ::CamelCaseController to /camel_case' do
    gen('CamelCaseController').should == '/camel_case'
  end

  it 'maps Module::ClassController to /module/class' do
    gen('Module::ClassController').should == '/module/class'
  end

  it 'maps Class to /class' do
    gen('Class').should == '/class'
  end

  it 'maps Module::Class to /module/class' do
    gen('Module::Class').should == '/module/class'
  end

  it 'maps Module::Module::Class to module/module/class' do
    gen('Module::Module::Class').should == '/module/module/class'
  end

  it "maps MainController to '/'" do
    gen('MainController').should == '/'
  end

  it "doesn't map ::Controller" do
    gen('Controller').should == nil
  end

  it "doesn't map anonymous classes" do
    gen(Class.new.name).should == nil
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
Pistos-ramaze-2009.06.12 spec/ramaze/controller/mapping.rb
manveru-ramaze-2009.07 spec/ramaze/controller/mapping.rb
ramaze-2011.12.28 spec/ramaze/controller/mapping.rb
ramaze-2011.10.23 spec/ramaze/controller/mapping.rb
ramaze-2011.07.25 spec/ramaze/controller/mapping.rb
ramaze-2011.01.30 spec/ramaze/controller/mapping.rb
ramaze-2011.01 spec/ramaze/controller/mapping.rb
ramaze-2010.06.18 spec/ramaze/controller/mapping.rb
ramaze-2010.04.04 spec/ramaze/controller/mapping.rb
ramaze-2010.04 spec/ramaze/controller/mapping.rb
ramaze-2010.03 spec/ramaze/controller/mapping.rb
ramaze-2010.01 spec/ramaze/controller/mapping.rb
ramaze-2009.10 spec/ramaze/controller/mapping.rb
ramaze-2009.07 spec/ramaze/controller/mapping.rb