mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
22 lines
498 B
Ruby
22 lines
498 B
Ruby
|
require 'helper'
|
||
|
RSpec.describe Pry::Config::Memoization do
|
||
|
let(:config) do
|
||
|
Class.new do
|
||
|
include Pry::Config::Memoization
|
||
|
def_memoized({foo: proc {"foo"}, bar: proc {"bar"}})
|
||
|
end.new
|
||
|
end
|
||
|
|
||
|
describe "on call of method" do
|
||
|
it "memoizes the return value" do
|
||
|
expect(config.foo).to be(config.foo)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
describe "#memoized_methods" do
|
||
|
it "tracks a list of memoized methods" do
|
||
|
expect(config.memoized_methods).to eq([:foo, :bar])
|
||
|
end
|
||
|
end
|
||
|
end
|