Module: RestfulSpec::Railtie::SpecRoutes

Defined in:
lib/restful_spec/railtie.rb

Instance Method Summary collapse

Instance Method Details

#resource(*resources, &block) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/restful_spec/railtie.rb', line 21

def resource(*resources, &block)
  super
  options = resources.extract_options!
  resource_scope(:resource, ActionDispatch::Routing::Mapper::Resources::SingletonResource.new(resources.pop, options)) do
    collection do
      match '/' => "#{parent_resource.controller}#spec", via: :options, as: :specification
    end
  end
end

#resources(*resources, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/restful_spec/railtie.rb', line 11

def resources(*resources, &block)
  super
  options = resources.extract_options!
  resource_scope(:resources, ActionDispatch::Routing::Mapper::Resources::Resource.new(resources.pop, options)) do
    collection do
      match '/' => "#{parent_resource.controller}#spec", via: :options, as: :specification
    end
  end
end