Skip to content

Commit

Permalink
Merge pull request #227 from rubytoolbox/co-upgrades
Browse files Browse the repository at this point in the history
Remove mistakenly committed gemspec
  • Loading branch information
colszowka authored May 17, 2024
2 parents a09f35b + d8defaf commit 2833c40
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 167 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ jobs:
fail-fast: false
matrix:
ruby:
- '3.0'
- '2.7'
- '2.6'
- '2.5'
- '3.3'
- '3.2'

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: actions/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: "${{matrix.ruby}}"
- name: Install dependencies and run RSpec
Expand All @@ -35,15 +33,13 @@ jobs:
fail-fast: false
matrix:
ruby:
- '3.0'
- '2.7'
- '2.6'
- '2.5'
- '3.3'
- '3.2'

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: actions/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: "${{matrix.ruby}}"
- name: Install dependencies and run rubocop"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/pkg/
/spec/reports/
/tmp/
Gemfile.lock

# rspec failure tracking
.rspec_status
15 changes: 15 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,19 @@ source "https://rubygems.org"
# Specify your gem's dependencies in rubytoolbox-api.gemspec
gemspec

gem "rubocop"
gem "rubocop-performance"
gem "rubocop-rake"
gem "rubocop-rspec"

gem "guard-bundler"
gem "guard-rspec"
gem "guard-rubocop"

gem "rspec", ">= 3.9"
gem "simplecov", ">= 0.18.5"

gem "vcr", ">= 5.1.0"
gem "webmock", ">= 3.8.3"

gem "rake", "~> 12.0"
130 changes: 0 additions & 130 deletions Gemfile.lock

This file was deleted.

8 changes: 4 additions & 4 deletions lib/rubytoolbox/api/response_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def field(name, &block)

block ||= ->(value) { value }

define_method "#{name}=" do |value|
instance_variable_set "@#{name}", block.call(value)
define_method :"#{name}=" do |value|
instance_variable_set :"@#{name}", block.call(value)
end

attr_reader name
private "#{name}="
private :"#{name}="
end

def fields
Expand All @@ -40,7 +40,7 @@ def initialize(data)
self.class.fields.each do |name|
value = data.key?(name.to_s) ? data[name.to_s] : data[name.to_sym]

send "#{name}=", value unless value.nil?
send :"#{name}=", value unless value.nil?
end
end

Expand Down
17 changes: 1 addition & 16 deletions rubytoolbox-api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require_relative "lib/rubytoolbox/api/version"

# rubocop:disable Metrics/BlockLength
Gem::Specification.new do |spec|
spec.name = "rubytoolbox-api"
spec.version = Rubytoolbox::Api::VERSION
Expand All @@ -27,19 +26,5 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "rubocop"
spec.add_development_dependency "rubocop-performance"
spec.add_development_dependency "rubocop-rake"
spec.add_development_dependency "rubocop-rspec"

spec.add_development_dependency "guard-bundler"
spec.add_development_dependency "guard-rspec"
spec.add_development_dependency "guard-rubocop"

spec.add_development_dependency "rspec", ">= 3.9"
spec.add_development_dependency "simplecov", ">= 0.18.5"

spec.add_development_dependency "vcr", ">= 5.1.0"
spec.add_development_dependency "webmock", ">= 3.8.3"
spec.metadata["rubygems_mfa_required"] = "true"
end
# rubocop:enable Metrics/BlockLength
8 changes: 4 additions & 4 deletions spec/rubytoolbox/api/response_wrapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
end

it "correctly handles false value when given as string key" do
expect(sample.new("foo" => false, bar: "123").foo).to be == false
expect(sample.new("foo" => false, bar: "123").foo).to be false
end

it "can be converted back to a hash" do # rubocop:disable RSpec/ExampleLength
Expand All @@ -41,15 +41,15 @@
subcollection: [{ key: "value" }]
)

expect(object.to_h).to be == {
expect(object.to_h).to eq(
"foo" => "foo",
"bar" => "rab",
"sub" => {
"key" => "value",
},
"subcollection" => [
{ "key" => "value" },
],
}
]
)
end
end
6 changes: 3 additions & 3 deletions spec/rubytoolbox/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
let(:client) { described_class.new }

it "has a version number" do
expect(Rubytoolbox::Api::VERSION).not_to be nil
expect(Rubytoolbox::Api::VERSION).not_to be_nil
end

describe "initializer" do
it "defaults endpoint_url to https://www.ruby-toolbox.com/api/" do
expect(described_class.new.endpoint_url).to be == "https://www.ruby-toolbox.com/api/"
expect(described_class.new.endpoint_url).to eq "https://www.ruby-toolbox.com/api/"
end

it "accepts a custom endpoint_url" do
expect(described_class.new(url: "http://localhost:5000/api/").endpoint_url).to be == "http://localhost:5000/api/"
expect(described_class.new(url: "http://localhost:5000/api/").endpoint_url).to eq "http://localhost:5000/api/"
end
end

Expand Down

0 comments on commit 2833c40

Please sign in to comment.