spec/base_spec.rb in bbcoder-1.0.1 vs spec/base_spec.rb in bbcoder-1.1.0

- old
+ new

@@ -4,15 +4,15 @@ subject { BBCoder.new("[p]Text and now [b]bolded.[/b][/p]") } context "#configuration" do before do - @tags = BBCoder::Configuration.class_variable_get(:@@tags).clone + @tags = BBCoder.configuration.tags.clone end after do - BBCoder::Configuration.class_variable_set(:@@tags, @tags) + BBCoder.configuration.tags = @tags end it "should return the same object for multiple calls" do BBCoder.configuration.should == BBCoder.configuration end @@ -29,25 +29,26 @@ end end context "#configure" do before do - @tags = BBCoder::Configuration.class_variable_get(:@@tags).clone + @tags = BBCoder.configuration.tags.clone end after do - BBCoder::Configuration.class_variable_set(:@@tags, @tags) + BBCoder.configuration.tags = @tags end it "should fail without a block" do lambda { BBCoder.configure }.should raise_error end it "should instance_eval the block onto configuration" do block = Proc.new { tag :p } - mock(BBCoder).configuration.stub!.instance_eval(&block) BBCoder.configure(&block) + + BBCoder.configuration.tags[:p].should_not be_nil end it "should be able to remove a tag" do BBCoder.configure do remove :spoiler @@ -73,6 +74,5 @@ subject.parse end end end -