spec/support/versioned_helpers.rb in grape-0.2.0 vs spec/support/versioned_helpers.rb in grape-0.2.1

- old
+ new

@@ -4,10 +4,12 @@ # Returns normal path otherwise. def versioned_path(options = {}) case options[:using] when :path File.join('/', options[:prefix] || '', options[:version], options[:path]) + when :param + File.join('/', options[:prefix] || '', options[:path]) when :header File.join('/', options[:prefix] || '', options[:path]) else raise ArgumentError.new("unknown versioning strategy: #{options[:using]}") end @@ -15,10 +17,12 @@ def versioned_headers(options) case options[:using] when :path {} # no-op + when :param + {} # no-op when :header { 'HTTP_ACCEPT' => "application/vnd.#{options[:vendor]}-#{options[:version]}+#{options[:format]}" } else @@ -27,8 +31,12 @@ end def versioned_get(path, version_name, version_options = {}) path = versioned_path(version_options.merge(:version => version_name, :path => path)) headers = versioned_headers(version_options.merge(:version => version_name)) - get path, {}, headers + params = {} + if version_options[:using] == :param + params = { version_options[:parameter] => version_name } + end + get path, params, headers end