Skip to content

Commit ae5fd2f

Browse files
committed
Add some specs for definitions
1 parent fba761e commit ae5fd2f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

spec/definition_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ class Test::Foo
1616
option :bar
1717
end
1818
end
19+
20+
it "preservers definition params" do
21+
params = Test::Foo.dry_initializer.params.map do |definition|
22+
[definition.source, definition.options]
23+
end
24+
25+
expect(params).to eq [[:foo, { as: :foo, reader: :public }]]
26+
end
27+
28+
it "preservers definition options" do
29+
options = Test::Foo.dry_initializer.options.map do |definition|
30+
[definition.source, definition.options]
31+
end
32+
33+
expect(options).to eq [[:bar, { as: :bar, reader: :public }]]
34+
end
1935
end
2036

2137
it_behaves_like :initializer, "extend Dry::Initializer" do

0 commit comments

Comments
 (0)