spec/unit/berkshelf_spec.rb in berkshelf-0.4.0.rc3 vs spec/unit/berkshelf_spec.rb in berkshelf-0.4.0.rc4

- old
+ new

@@ -43,7 +43,34 @@ Chef::Config.should_receive(:from_file).with(Berkshelf.config_path) subject.load_config end end + + describe "::formatter" do + context "with default formatter" do + it "should be human readable" do + Berkshelf.formatter.should be_an_instance_of(Berkshelf::Formatters::HumanReadable) + end + end + + context "with a custom formatter" do + before(:all) do + Berkshelf.instance_eval { @formatter = nil } + end + + class CustomFormatter + include Berkshelf::Formatters::AbstractFormatter + Berkshelf.formatters["custom"] = self + end + + before do + Berkshelf.set_format "custom" + end + + it "should be the custom class" do + Berkshelf.formatter.should be_an_instance_of(CustomFormatter) + end + end + end end end