Sha256: 6812d580c59fc768b918ed9d02d856edbcfd51d5556f6cb4924f54cd6b1bceb6

Contents?: true

Size: 857 Bytes

Versions: 35

Compression:

Stored size: 857 Bytes

Contents

require File.join(File.dirname(__FILE__), '/../../test_helper')

class PageRouteTest < ActiveSupport::TestCase
  
  def test_create
    page = Factory(:page, :path => "/things/overview")
    route = page.page_routes.build(:pattern => "/things/:year/:month/:day")
    route.add_requirement(:year, "\\d{4,}")
    route.add_requirement(:month, "\\d{2,}")
    route.add_requirement(:day, "\\d{2,}")
    route.add_condition(:method, "get")
    
    assert route.save
    assert_equal "/things/:year/:month/:day", route.pattern
    assert_equal({ 
      :controller => "cms/content", 
      :action => "show_page_route",
      :_page_route_id => route.id.to_s,
      :requirements => {
        :year => /\d{4,}/,
        :month => /\d{2,}/,
        :day => /\d{2,}/
      }, :conditions => {
        :method => :get
      }
    }, route.options_map)
  end
  
end

Version data entries

35 entries across 35 versions & 11 rubygems

Version Path
SFEley-browsercms-3.0.2 test/unit/models/page_route_test.rb
buzzware-browsercms-3.0.2 test/unit/models/page_route_test.rb
coredumplings-browsercms-3.0.0 test/unit/models/page_route_test.rb
nate-browsercms-3.0.210 test/unit/models/page_route_test.rb
nate-browsercms-3.0.211 test/unit/models/page_route_test.rb
we5-browsercms-3.0.1.1 test/unit/models/page_route_test.rb
webficient-browsercms-3.0.1 test/unit/models/page_route_test.rb
webficient-browsercms-3.0.2 test/unit/models/page_route_test.rb
webficient-browsercms-3.0.3 test/unit/models/page_route_test.rb
webficient-browsercms-3.0.4 test/unit/models/page_route_test.rb
browsercms-3.1.5 test/unit/models/page_route_test.rb
browsercms-3.1.4 test/unit/models/page_route_test.rb
browsercms-3.1.3 test/unit/models/page_route_test.rb
bf4-browsercms-3.1.0 test/unit/models/page_route_test.rb
drujensen-browsercms-3.2.0 test/unit/models/page_route_test.rb
browsercmsi-3.1.2 test/unit/models/page_route_test.rb
browsercms-3.1.2 test/unit/models/page_route_test.rb
browsercms-3.1.1 test/unit/models/page_route_test.rb
browsercmsi-3.1.1 test/unit/models/page_route_test.rb
browsercmsi-3.1.0 test/unit/models/page_route_test.rb