diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index a399993..fadb7f8 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -10,7 +10,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3.3 - name: Install dependencies run: bundle install - name: Run linter @@ -24,16 +24,16 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3.3 - name: Install bundler - run: gem install bundler -v 2.1.1 + run: gem install bundler - name: Install dependencies - run: bundle _2.1.1_ install + run: bundle install - name: Run tests - run: bundle exec rake spec + run: bundle exec rspec - name: Upload coverage artifacts uses: actions/upload-artifact@v2 diff --git a/lib/geoserver/publish/config.rb b/lib/geoserver/publish/config.rb index c67a9a3..2f88c32 100644 --- a/lib/geoserver/publish/config.rb +++ b/lib/geoserver/publish/config.rb @@ -10,7 +10,12 @@ def config # :nocov: def config_yaml file_path = File.join(Geoserver::Publish.root, "config", "config.yml") - YAML.safe_load(ERB.new(File.read(file_path)).result, [], [], true) + yaml_text = ERB.new(File.read(file_path)).result + if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("3.1.0.pre1") + YAML.safe_load(yaml_text, aliases: true) + else + YAML.safe_load(yaml_text, [], [], true) + end end # :nocov: diff --git a/spec/geoserver/publish/coverage_spec.rb b/spec/geoserver/publish/coverage_spec.rb index ca15267..6b483b7 100644 --- a/spec/geoserver/publish/coverage_spec.rb +++ b/spec/geoserver/publish/coverage_spec.rb @@ -36,7 +36,7 @@ end it "returns a true" do - expect(coverage_object.create(params)).to be true + expect(coverage_object.create(**params)).to be true end end @@ -46,7 +46,7 @@ end it "raises an error" do - expect { coverage_object.create(params) }.to raise_error(Geoserver::Publish::Error) + expect { coverage_object.create(**params) }.to raise_error(Geoserver::Publish::Error) end end @@ -67,7 +67,7 @@ new_payload = JSON.parse(payload) new_payload["coverage"].merge!(params[:additional_payload]) stubbed = stub_geoserver_post(path: path, payload: new_payload.to_json, status: 201) - coverage_object.create(params) + coverage_object.create(**params) expect(stubbed).to have_been_requested end end @@ -95,7 +95,7 @@ new_payload["coverage"].merge!(params[:additional_payload]) stub_geoserver_put(payload: new_payload.to_json, path: path, status: 200, content_type: "application/json") - expect(coverage_object.update(params)).to be true + expect(coverage_object.update(**params)).to be true end end @@ -107,7 +107,7 @@ new_payload["coverage"].merge!(params[:additional_payload]) stub_geoserver_put(payload: new_payload.to_json, path: path, status: 404, content_type: "application/json") - expect { coverage_object.update(params) }.to raise_error(Geoserver::Publish::Error) + expect { coverage_object.update(**params) }.to raise_error(Geoserver::Publish::Error) end end end @@ -121,7 +121,7 @@ end it "makes a delete request and returns true" do - expect(coverage_object.delete(params)).to be true + expect(coverage_object.delete(**params)).to be true end end @@ -133,7 +133,7 @@ end it "makes a delete request to geoserver and raises an exception" do - expect { coverage_object.delete(params) }.to raise_error(Geoserver::Publish::Error) + expect { coverage_object.delete(**params) }.to raise_error(Geoserver::Publish::Error) end end end @@ -147,7 +147,7 @@ end it "returns a the properties as a hash" do - expect(coverage_object.find(params)).to eq(JSON.parse(response)) + expect(coverage_object.find(**params)).to eq(JSON.parse(response)) end end @@ -159,7 +159,7 @@ end it "returns nil" do - expect(coverage_object.find(params)).to be_nil + expect(coverage_object.find(**params)).to be_nil end end end diff --git a/spec/geoserver/publish/coverage_store_spec.rb b/spec/geoserver/publish/coverage_store_spec.rb index 207d422..21e5c97 100644 --- a/spec/geoserver/publish/coverage_store_spec.rb +++ b/spec/geoserver/publish/coverage_store_spec.rb @@ -33,7 +33,7 @@ end it "returns a the properties as a hash" do - expect(coveragestore_object.create(params)).to be true + expect(coveragestore_object.create(**params)).to be true end end @@ -43,7 +43,7 @@ end it "raises an exception" do - expect { coveragestore_object.create(params) }.to raise_error(Geoserver::Publish::Error) + expect { coveragestore_object.create(**params) }.to raise_error(Geoserver::Publish::Error) end end @@ -66,7 +66,7 @@ new_payload = JSON.parse(payload) new_payload["coverageStore"].merge!(params[:additional_payload]) stubbed = stub_geoserver_post(path: path, payload: new_payload.to_json, status: 201) - coveragestore_object.create(params) + coveragestore_object.create(**params) expect(stubbed).to have_been_requested end end @@ -93,7 +93,7 @@ new_payload["coverageStore"].merge!(params[:additional_payload]) stub_geoserver_put(payload: new_payload.to_json, path: path, status: 200, content_type: "application/json") - expect(coveragestore_object.update(params)).to be true + expect(coveragestore_object.update(**params)).to be true end end @@ -105,7 +105,7 @@ new_payload["coverageStore"].merge!(params[:additional_payload]) stub_geoserver_put(payload: new_payload.to_json, path: path, status: 404, content_type: "application/json") - expect { coveragestore_object.update(params) }.to raise_error(Geoserver::Publish::Error) + expect { coveragestore_object.update(**params) }.to raise_error(Geoserver::Publish::Error) end end end @@ -119,7 +119,7 @@ end it "makes a delete request and returns true" do - expect(coveragestore_object.delete(params)).to be true + expect(coveragestore_object.delete(**params)).to be true end end @@ -131,7 +131,7 @@ end it "makes a delete request to geoserver and raises an exception" do - expect { coveragestore_object.delete(params) }.to raise_error(Geoserver::Publish::Error) + expect { coveragestore_object.delete(**params) }.to raise_error(Geoserver::Publish::Error) end end end @@ -145,7 +145,7 @@ end it "returns a the properties as a hash" do - expect(coveragestore_object.find(params)).to eq(JSON.parse(response)) + expect(coveragestore_object.find(**params)).to eq(JSON.parse(response)) end end @@ -157,7 +157,7 @@ end it "returns nil" do - expect(coveragestore_object.find(params)).to be_nil + expect(coveragestore_object.find(**params)).to be_nil end end end @@ -182,7 +182,7 @@ end it "returns true" do - expect(coveragestore_object.upload(params)).to be true + expect(coveragestore_object.upload(**params)).to be true end end @@ -192,7 +192,7 @@ end it "raises an exception" do - expect { coveragestore_object.upload(params) }.to raise_error(Geoserver::Publish::Error) + expect { coveragestore_object.upload(**params) }.to raise_error(Geoserver::Publish::Error) end end end diff --git a/spec/geoserver/publish/data_store_spec.rb b/spec/geoserver/publish/data_store_spec.rb index defd1b7..a3e6316 100644 --- a/spec/geoserver/publish/data_store_spec.rb +++ b/spec/geoserver/publish/data_store_spec.rb @@ -33,7 +33,7 @@ end it "returns true" do - expect(datastore_object.create(params)).to be true + expect(datastore_object.create(**params)).to be true end end @@ -43,7 +43,7 @@ end it "raises an exception" do - expect { datastore_object.create(params) }.to raise_error(Geoserver::Publish::Error) + expect { datastore_object.create(**params) }.to raise_error(Geoserver::Publish::Error) end end end @@ -57,7 +57,7 @@ end it "makes a delete request and returns true" do - expect(datastore_object.delete(params)).to be true + expect(datastore_object.delete(**params)).to be true end end @@ -69,7 +69,7 @@ end it "makes a delete request to geoserver and raises an exception" do - expect { datastore_object.delete(params) }.to raise_error(Geoserver::Publish::Error) + expect { datastore_object.delete(**params) }.to raise_error(Geoserver::Publish::Error) end end end @@ -83,7 +83,7 @@ end it "returns the properties as a hash" do - expect(datastore_object.find(params)).to eq(JSON.parse(response)) + expect(datastore_object.find(**params)).to eq(JSON.parse(response)) end end @@ -95,7 +95,7 @@ end it "returns nil" do - expect(datastore_object.find(params)).to be_nil + expect(datastore_object.find(**params)).to be_nil end end end @@ -129,7 +129,7 @@ end it "returns true" do - expect(datastore_object.upload(params)).to be true + expect(datastore_object.upload(**params)).to be true end end @@ -139,7 +139,7 @@ end it "returns true" do - expect(datastore_object.upload(params)).to be true + expect(datastore_object.upload(**params)).to be true end end @@ -149,7 +149,7 @@ end it "raises an exception" do - expect { datastore_object.upload(params) }.to raise_error(Geoserver::Publish::Error) + expect { datastore_object.upload(**params) }.to raise_error(Geoserver::Publish::Error) end end end diff --git a/spec/geoserver/publish/feature_type_spec.rb b/spec/geoserver/publish/feature_type_spec.rb index 8aae5fe..336475a 100644 --- a/spec/geoserver/publish/feature_type_spec.rb +++ b/spec/geoserver/publish/feature_type_spec.rb @@ -36,7 +36,7 @@ end it "returns a true" do - expect(feature_type_object.create(params)).to be true + expect(feature_type_object.create(**params)).to be true end end @@ -46,7 +46,7 @@ end it "raises an exception" do - expect { feature_type_object.create(params) }.to raise_error(Geoserver::Publish::Error) + expect { feature_type_object.create(**params) }.to raise_error(Geoserver::Publish::Error) end end @@ -70,7 +70,7 @@ new_payload = JSON.parse(payload) new_payload["featureType"].merge!(params[:additional_payload]) stubbed = stub_geoserver_post(path: path, payload: new_payload.to_json, status: 201) - feature_type_object.create(params) + feature_type_object.create(**params) expect(stubbed).to have_been_requested end end @@ -99,7 +99,7 @@ new_payload["featureType"].merge!(params[:additional_payload]) stub_geoserver_put(payload: new_payload.to_json, path: path, status: 200, content_type: "application/json") - expect(feature_type_object.update(params)).to be true + expect(feature_type_object.update(**params)).to be true end end @@ -111,7 +111,7 @@ new_payload["featureType"].merge!(params[:additional_payload]) stub_geoserver_put(payload: new_payload.to_json, path: path, status: 404, content_type: "application/json") - expect { feature_type_object.update(params) }.to raise_error(Geoserver::Publish::Error) + expect { feature_type_object.update(**params) }.to raise_error(Geoserver::Publish::Error) end end end @@ -125,7 +125,7 @@ end it "makes a delete request and returns true" do - expect(feature_type_object.delete(params)).to be true + expect(feature_type_object.delete(**params)).to be true end end @@ -137,7 +137,7 @@ end it "makes a delete request to geoserver and raises an exception" do - expect { feature_type_object.delete(params) }.to raise_error(Geoserver::Publish::Error) + expect { feature_type_object.delete(**params) }.to raise_error(Geoserver::Publish::Error) end end end @@ -151,7 +151,7 @@ end it "returns a the properties as a hash" do - expect(feature_type_object.find(params)).to eq(JSON.parse(response)) + expect(feature_type_object.find(**params)).to eq(JSON.parse(response)) end end @@ -163,7 +163,7 @@ end it "returns nil" do - expect(feature_type_object.find(params)).to be_nil + expect(feature_type_object.find(**params)).to be_nil end end end