Sha256: 370f0b43dd8e34c5c64bb3d03af5c8a190f63179fd7517a505798ee99cc4a298
Contents?: true
Size: 803 Bytes
Versions: 24
Compression:
Stored size: 803 Bytes
Contents
RSpec.describe "EitilCore Kernel#all_kwargs_to_ivars!" do it "should set all hash keys, nested within a positional hash, to instance variables" do def test_method(a, b, c, kwargs) all_kwargs_to_ivars! :kwargs end test_method(1, "two", :three, {a: 0, b: "not_two", c: :not_three}) expect(@a).to eq 0 expect(@b).to eq "not_two" expect(@c).to eq :not_three expect(@d).to be_nil end it "should set all hash keys, nested within a keyword hash, to instance variables" do def test_method(a, b, c, kwargs:) all_kwargs_to_ivars! :kwargs end test_method(1, "two", :three, kwargs: {a: 0, b: "not_two", c: :not_three}) expect(@a).to eq 0 expect(@b).to eq "not_two" expect(@c).to eq :not_three expect(@d).to be_nil end end
Version data entries
24 entries across 24 versions & 1 rubygems