Sha256: e076b495b55ce8580973a1515b19891ba27e532ac15fb15c1676f8f9eb195370

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

require 'spec/helper'

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

8 entries across 8 versions & 3 rubygems

Version Path
manveru-ramaze-2009.06.04 spec/ramaze/controller/mapping.rb
manveru-ramaze-2009.06.12 spec/ramaze/controller/mapping.rb
manveru-ramaze-2009.06 spec/ramaze/controller/mapping.rb
rjspotter-ramaze-2009.06.29 spec/ramaze/controller/mapping.rb
rjspotter-ramaze-2009.06.31 spec/ramaze/controller/mapping.rb
ramaze-2009.06.12 spec/ramaze/controller/mapping.rb
ramaze-2009.06.04 spec/ramaze/controller/mapping.rb
ramaze-2009.06 spec/ramaze/controller/mapping.rb