spec/schematic/generator/sandbox_spec.rb in schematic-0.5.4 vs spec/schematic/generator/sandbox_spec.rb in schematic-0.5.5
- old
+ new
@@ -3,22 +3,33 @@
describe Schematic::Generator::Sandbox do
subject { Schematic::Generator::Sandbox.new(klass) }
let(:klass) { Object }
describe "ignoring elements" do
- it "should add the method to the ignored list" do
- subject.run do
- ignore :foo
+ context "on the base element" do
+ it "should add the method to the ignored list" do
+ subject.run do
+ ignore :foo
+ end
+ subject.ignored_elements.should include(:foo)
end
- subject.ignored_elements.should include(:foo)
+
+ it "accepts multiple fields" do
+ subject.run do
+ ignore :foo, :bar
+ end
+ subject.ignored_elements.should include(:foo)
+ subject.ignored_elements.should include(:bar)
+ end
end
- it "accepts multiple fields" do
- subject.run do
- ignore :foo, :bar
+ context "on nested elements" do
+ it "should remove the method to the element list" do
+ subject.run do
+ ignore :foo => [:bar]
+ end
+ subject.ignored_elements[:foo].should == [:bar]
end
- subject.ignored_elements.should include(:foo)
- subject.ignored_elements.should include(:bar)
end
end
describe "adding elements" do
context "given a single element" do