1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/spec/config/value_spec.rb
Kyrylo Silin 18c45d26c5 rubocop: enable the Style/FrozenStringLiteralComment cop
This will greatly ease Pry support on Ruby 3.0 (when it's out).
2019-05-08 00:13:17 +03:00

39 lines
993 B
Ruby

# frozen_string_literal: true
RSpec.describe Pry::Config::Value do
describe "#call" do
context "when given value is a MemoizedValue" do
subject { described_class.new(Pry::Config::MemoizedValue.new { 123 }) }
it "calls the MemoizedLazy object" do
expect(subject.call).to eq(123)
end
end
context "when given value is a LazyValue" do
subject { described_class.new(Pry::Config::LazyValue.new { 123 }) }
it "calls the LazyValue object" do
expect(subject.call).to eq(123)
end
end
context "when given value is a Proc" do
let(:callable) { proc {} }
subject { described_class.new(callable) }
it "returns the value as is" do
expect(subject.call).to eq(callable)
end
end
context "when given value is a non-callable object" do
subject { described_class.new('test') }
it "returns the value as is" do
expect(subject.call).to eq('test')
end
end
end
end