Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby3 support #31

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion lib/geoserver/publish/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
18 changes: 9 additions & 9 deletions spec/geoserver/publish/coverage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down
22 changes: 11 additions & 11 deletions spec/geoserver/publish/coverage_store_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down
18 changes: 9 additions & 9 deletions spec/geoserver/publish/data_store_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
18 changes: 9 additions & 9 deletions spec/geoserver/publish/feature_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down
Loading