Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
biow0lf committed Jan 2, 2025
1 parent 7fac1e3 commit 644e3f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
9 changes: 4 additions & 5 deletions lib/eve_online/esi/universe_category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ class UniverseCategory < Base

API_PATH = "/v1/universe/categories/%<category_id>s/"

attr_reader :id
attr_reader :category_id

def initialize(options)
super

@id = options.fetch(:id)
@category_id = options.fetch(:category_id)
end

def_delegators :model, :as_json, :category_id, :name, :published,
:group_ids
def_delegators :model, :as_json, :id, :name, :published, :group_ids

def model
@model ||= Models::Category.new(response)
Expand All @@ -32,7 +31,7 @@ def additional_query_params
end

def path
format(API_PATH, category_id: id)
format(API_PATH, category_id: category_id)
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/eve_online/esi/universe_category_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "spec_helper"

describe EveOnline::ESI::UniverseCategory do
let(:options) { {id: 6} }
let(:options) { {category_id: 6} }

subject { described_class.new(options) }

Expand All @@ -20,7 +20,7 @@

its(:_write_timeout) { should eq(60) }

its(:id) { should eq(6) }
its(:category_id) { should eq(6) }
end

describe "#model" do
Expand Down Expand Up @@ -62,14 +62,14 @@
specify { expect { subject.as_json }.not_to raise_error }
end

describe "#category_id" do
describe "#id" do
let(:model) { instance_double(EveOnline::ESI::Models::Category) }

before { subject.instance_variable_set(:@model, model) }

before { expect(model).to receive(:category_id) }
before { expect(model).to receive(:id) }

specify { expect { subject.category_id }.not_to raise_error }
specify { expect { subject.id }.not_to raise_error }
end

describe "#name" do
Expand Down

0 comments on commit 644e3f5

Please sign in to comment.