spec/inform_spec.rb in inform-0.0.6 vs spec/inform_spec.rb in inform-0.0.7

- old
+ new

@@ -8,10 +8,19 @@ end it "should interpolate keyword arguments" do $stdout.should_receive(:print).with(/hello.+hey.+you.+goodbye/) Inform.send(method, "hello %{a} %{b} goodbye", :a => 'hey', :b => 'you') end + it "should prefix with the :inform thread variable if present" do + begin + Inform.thread_prefix = 'hi' + $stdout.should_receive(:print).with(/^hi .+blank/) + Inform.send(method, "blank") + ensure + Inform.thread_prefix = nil + end + end end end def should_not_print method describe method do @@ -55,39 +64,39 @@ describe :level= do it "should set the log level" do Inform.level = :info Inform.level.should == :info end - + it "should not allow us to set a log level that isn't recognized" do lambda {Inform.level = :warble}.should raise_error /unrecognized/i end end - + context "with log level debug" do before { Inform.level = :debug } - should_print :debug - should_print :info + should_print :debug + should_print :info should_accept_block :info # should_accept_block :debug should_print :warning should_print :error end - + context "with log level set to :info" do before { Inform.level = :info } should_not_print :debug should_print :info should_accept_block :info # should_accept_block :debug - + should_print :warning should_print :error end - + context "with log level set to :warning" do before { Inform.level = :warning } should_not_print :debug should_not_print :info should_print :warning @@ -98,13 +107,13 @@ before { Inform.level = :error } should_not_print :debug should_not_print :info should_not_print :warning should_print :error - + describe :info do it "should still execute the code block" do Inform.info("") { 'hello' }.should == 'hello' end end end -end \ No newline at end of file +end