spec/lib/path_string_spec.rb in grape-swagger-0.26.1 vs spec/lib/path_string_spec.rb in grape-swagger-0.27.0
- old
+ new
@@ -1,13 +1,22 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe GrapeSwagger::DocMethods::PathString do
subject { described_class }
specify { expect(subject).to eql GrapeSwagger::DocMethods::PathString }
specify { expect(subject).to respond_to :build }
- describe 'operation_id_object' do
+ describe 'path_string_object' do
+ specify 'The original route path is not mutated' do
+ route = Struct.new(:version, :path).new
+ route.path = '/foo/:dynamic/bar'
+ subject.build(route, add_version: true)
+ expect(route.path).to eq '/foo/:dynamic/bar'
+ end
+
describe 'version' do
describe 'defaults: given, true' do
let(:options) { { add_version: true } }
let(:route) { Struct.new(:version, :path).new('v1') }