Class: ShouldaRouting::Resources::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/shoulda_routing/resources/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &block) ⇒ Base

Returns a new instance of Base.



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

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

Instance Attribute Details

#blockObject

Returns the value of attribute block.



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

def block
  @block
end

#currentObject

Returns the value of attribute current.



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

def current
  @current
end

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#test!Object



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

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

  Routes::STACK.routes.each do |route|
    specs_for(routeable_actions, route)
    specs_for(unrouteable_actions, route, :not_to)
  end

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