Class: ShouldaRouting::Resources::Base

Inherits:
Object
  • Object
show all
Includes:
ShouldaRouting::Routes::Helpers
Defined in:
lib/shoulda_routing/resources/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ShouldaRouting::Routes::Helpers

#route_params, #route_path, #route_permutations

Constructor Details

#initialize(*args, &block) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
# File 'lib/shoulda_routing/resources/base.rb', line 8

def initialize *args, &block
  @options = args.extract_options!
  @current = args
  @block   = block
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



6
7
8
# File 'lib/shoulda_routing/resources/base.rb', line 6

def block
  @block
end

#currentObject

Returns the value of attribute current.



6
7
8
# File 'lib/shoulda_routing/resources/base.rb', line 6

def current
  @current
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/shoulda_routing/resources/base.rb', line 6

def options
  @options
end

Instance Method Details

#test!Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/shoulda_routing/resources/base.rb', line 14

def test!
  Routes::STACK.push(current)

  route_permutations(Routes::STACK).each do |stack|
    specs_for(routeable_actions, stack)
    specs_for(unrouteable_actions, stack, :not_to)
  end

  DSL.instance_eval(&block) if block
  Routes::STACK.pop
end