Skip to content

Commit

Permalink
Add spec for testing logic branches when use_hashed_arguments is false
Browse files Browse the repository at this point in the history
  • Loading branch information
obrie committed Jan 13, 2025
1 parent 0665e76 commit 727fed4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/memery_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class H

before { CALLS.clear }
before { B_CALLS.clear }
before { Memery.use_hashed_arguments = true }

let(:unmemoized_class) do
Class.new do
Expand Down Expand Up @@ -357,6 +358,26 @@ class H
end
end

context "without hashed arguments" do
before { Memery.use_hashed_arguments = false }

context "methods without args" do
specify do
values = [ a.m, a.m_nil, a.m, a.m_nil ]
expect(values).to eq([:m, nil, :m, nil])
expect(CALLS).to eq([:m, nil])
end
end

context "method with args" do
specify do
values = [ a.m_args(1, 1), a.m_args(1, 1), a.m_args(1, 2) ]
expect(values).to eq([[1, 1], [1, 1], [1, 2]])
expect(CALLS).to eq([[1, 1], [1, 2]])
end
end
end

describe ":condition option" do
before do
a.environment = environment
Expand Down

0 comments on commit 727fed4

Please sign in to comment.