Skip to content

Commit

Permalink
test(has_instance_proxy): add specs
Browse files Browse the repository at this point in the history
  • Loading branch information
marian13 committed Jan 11, 2024
1 parent 98b52fb commit 488c94e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@ class InstanceProxy
# @param target [Object] Can be any type.
# @return [void]
#
# @internal
# TODO: Direct Specs.
#
def initialize(target:)
@__convenient_service_instance_proxy_target__ = target
end

##
# @return [Object] Can be any type.
#
# @internal
# TODO: Direct Specs.
#
def instance_proxy_target
@__convenient_service_instance_proxy_target__
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
##
# TODO: Specs.
##
# frozen_string_literal: true

require "spec_helper"

require "convenient_service"

# rubocop:disable RSpec/NestedGroups, RSpec/MultipleMemoizedHelpers
RSpec.describe ConvenientService::Common::Plugins::HasInstanceProxy::Entities::InstanceProxy do
let(:instance_proxy) { described_class.new(target: target) }
let(:target) { "foo" }

example_group "instance methods" do
describe "#instance_proxy_target" do
it "returns `target` passed to constructor" do
expect(instance_proxy.instance_proxy_target).to eq(target)
end

it "uses `@__convenient_service_instance_proxy_target__` as instance variable" do
expect(instance_proxy.instance_proxy_target).to eq(instance_proxy.instance_variable_get(:@__convenient_service_instance_proxy_target__))
end
end
end
end
# rubocop:enable RSpec/NestedGroups, RSpec/MultipleMemoizedHelpers

0 comments on commit 488c94e

Please sign in to comment.