spec/hexx/dependencies_spec.rb in hexx-5.3.0 vs spec/hexx/dependencies_spec.rb in hexx-5.4.0
- old
+ new
@@ -38,10 +38,15 @@
it "accepts arrays" do
expect { described_module.depends_on "item", [:item] }
.not_to raise_error
end
+ it "accepts default option" do
+ expect { described_module.depends_on :item, default: Hexx::Service }
+ .not_to raise_error
+ end
+
it "fails when wrong object given" do
expect { described_module.depends_on 1 }.to raise_error TypeError
end
it "fails when blank object given" do
@@ -83,9 +88,18 @@
expect { described_module.item = 1 }.to raise_error TypeError
end
it "fails if blank string given" do
expect { described_module.item = "" }.to raise_error ArgumentError
+ end
+ end
+
+ context ":item, default: Hexx::Service" do
+
+ before { described_module.depends_on :item, default: "Hexx::Service" }
+
+ it "sets default value for the item" do
+ expect(described_module.item).to eq Hexx::Service
end
end
end
end
end