class ShouldaRouting::Routes::Spec

Attributes

action[RW]
controller[RW]
method[RW]
params[RW]
path[RW]
via[RW]

Public Class Methods

execute() { |generator| ... } click to toggle source
# File lib/shoulda_routing/routes/spec.rb, line 22
def self.execute
  generator = self.new
  yield(generator) if block_given?
  generator.test!
end

Public Instance Methods

test!() click to toggle source
# File lib/shoulda_routing/routes/spec.rb, line 7
def test!
  via         = @via        || :get
  path        = @path       || "/"
  controller  = @controller || ""
  action      = @action     || :index
  params      = @params     || {}
  method      = @method     || :to

  RSpec::Core::DSL.describe type: :routing do
    it "routes to #{path}" do
      expect(via => path).send method, route_to("#{controller}##{action}", params)
    end
  end
end