Sha256: 3619edf25f0f6f6272e840eb1e1f9942c759e29150ea534a96d424c7a8d8b64a

Contents?: true

Size: 752 Bytes

Versions: 2

Compression:

Stored size: 752 Bytes

Contents

module ShouldaRouting
  module Routes
    class Spec

      attr_accessor :via, :path, :controller, :action, :params, :method

      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

      def self.execute
        generator = self.new
        yield(generator) if block_given?
        generator.test!
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoulda_routing-0.0.2 lib/shoulda_routing/routes/spec.rb
shoulda_routing-0.0.1 lib/shoulda_routing/routes/spec.rb