Sha256: dca703a951dfdc8729f0a366765a1cda9003cfe861bee6ec92596e518fd73272
Contents?: true
Size: 778 Bytes
Versions: 15
Compression:
Stored size: 778 Bytes
Contents
require 'rails_helper' RSpec.describe ActiveAdmin::DynamicSettingsNode do subject { ActiveAdmin::DynamicSettingsNode.build } context "StringSymbolOrProcSetting" do before { subject.register :foo, 'bar', :string_symbol_or_proc } it "should pass through a string" do subject.foo = "string" expect(subject.foo(self)).to eq "string" end it "should instance_exec if context given" do ctx = Hash[i: 42] subject.foo = proc { self[:i] += 1 } expect(subject.foo(ctx)).to eq 43 expect(subject.foo(ctx)).to eq 44 end it "should send message if symbol given" do ctx = double expect(ctx).to receive(:quux).and_return 'qqq' subject.foo = :quux expect(subject.foo(ctx)).to eq 'qqq' end end end
Version data entries
15 entries across 15 versions & 3 rubygems