From 4f382c9e60307e9a49f89c6d46f3514aacdc38f8 Mon Sep 17 00:00:00 2001 From: Rudolf Schmidt Date: Thu, 20 Jun 2013 11:57:56 +0200 Subject: [PATCH] CHORE: Updates specs a little for consistency --- spec/yell/adapters/base_spec.rb | 2 +- spec/yell/adapters/datefile_spec.rb | 8 ++++---- spec/yell/adapters/file_spec.rb | 6 +++--- spec/yell/adapters/io_spec.rb | 2 +- spec/yell/adapters/streams_spec.rb | 4 ++-- spec/yell/adapters_spec.rb | 4 ++-- spec/yell/configuration_spec.rb | 2 +- spec/yell/event_spec.rb | 14 +++++++------- spec/yell/level_spec.rb | 1 + spec/yell/logger_spec.rb | 20 ++++++++++---------- spec/yell/repository_spec.rb | 4 ++-- spec/yell/silencer_spec.rb | 9 +++++---- spec/yell_spec.rb | 12 ++++++------ 13 files changed, 45 insertions(+), 43 deletions(-) diff --git a/spec/yell/adapters/base_spec.rb b/spec/yell/adapters/base_spec.rb index 60395f3..d0e62c0 100644 --- a/spec/yell/adapters/base_spec.rb +++ b/spec/yell/adapters/base_spec.rb @@ -20,7 +20,7 @@ end end - context ":write" do + context "#write" do let(:logger) { Yell::Logger.new } subject { Yell::Adapters::Base.new(:level => 1) } diff --git a/spec/yell/adapters/datefile_spec.rb b/spec/yell/adapters/datefile_spec.rb index 154e789..e1d30d7 100644 --- a/spec/yell/adapters/datefile_spec.rb +++ b/spec/yell/adapters/datefile_spec.rb @@ -20,7 +20,7 @@ it { should be_kind_of Yell::Adapters::File } - describe ":write" do + describe "#write" do let(:today_lines) { File.readlines(today_filename) } before do @@ -63,7 +63,7 @@ end end - describe ":keep" do + describe "#keep" do before do adapter.symlink = false # to not taint the Dir adapter.keep = 2 @@ -82,7 +82,7 @@ end end - describe ":symlink" do + describe "#symlink" do context "when true (default)" do before do adapter.write(event) @@ -114,7 +114,7 @@ end end - describe ":header" do + describe "#header" do let(:header) { File.open(today_filename, &:readline) } context "when true (default)" do diff --git a/spec/yell/adapters/file_spec.rb b/spec/yell/adapters/file_spec.rb index fb9187d..785cb80 100644 --- a/spec/yell/adapters/file_spec.rb +++ b/spec/yell/adapters/file_spec.rb @@ -9,13 +9,13 @@ it { should be_kind_of(Yell::Adapters::Io) } - context ":stream" do + context "#stream" do subject { Yell::Adapters::File.new.send(:stream) } it { should be_kind_of(File) } end - context ":write" do + context "#write" do let(:logger) { Yell::Logger.new } let(:event) { Yell::Event.new(logger, 1, "Hello World") } @@ -52,7 +52,7 @@ end end - context ":sync" do + context "#sync" do let(:adapter) { Yell::Adapters::File.new } it "should sync by default" do diff --git a/spec/yell/adapters/io_spec.rb b/spec/yell/adapters/io_spec.rb index c754443..1ffbe18 100644 --- a/spec/yell/adapters/io_spec.rb +++ b/spec/yell/adapters/io_spec.rb @@ -44,7 +44,7 @@ end end - context ":write" do + context "#write" do let(:logger) { Yell::Logger.new } let(:event) { Yell::Event.new(logger, 1, "Hello World") } let(:adapter) { Yell::Adapters::Io.new } diff --git a/spec/yell/adapters/streams_spec.rb b/spec/yell/adapters/streams_spec.rb index 8ebe5e6..1dd9095 100644 --- a/spec/yell/adapters/streams_spec.rb +++ b/spec/yell/adapters/streams_spec.rb @@ -4,7 +4,7 @@ it { should be_kind_of(Yell::Adapters::Io) } - context ":stream" do + context "#stream" do subject { Yell::Adapters::Stdout.new.send :stream } it { should be_kind_of(IO) } @@ -16,7 +16,7 @@ it { should be_kind_of(Yell::Adapters::Io) } - context ":stream" do + context "#stream" do subject { Yell::Adapters::Stderr.new.send(:stream) } it { should be_kind_of(IO) } diff --git a/spec/yell/adapters_spec.rb b/spec/yell/adapters_spec.rb index 0da59a6..bbb1495 100644 --- a/spec/yell/adapters_spec.rb +++ b/spec/yell/adapters_spec.rb @@ -2,7 +2,7 @@ describe Yell::Adapters do - context ":new" do + context ".new" do it "should accept an adapter instance" do stdout = Yell::Adapters::Stdout.new adapter = Yell::Adapters.new(stdout) @@ -29,7 +29,7 @@ end end - context ":register" do + context ".register" do let(:name) { :test } let(:klass) { mock } diff --git a/spec/yell/configuration_spec.rb b/spec/yell/configuration_spec.rb index e078e81..1010b89 100644 --- a/spec/yell/configuration_spec.rb +++ b/spec/yell/configuration_spec.rb @@ -2,7 +2,7 @@ describe Yell::Configuration do - describe ":load!" do + describe ".load!" do let(:file) { fixture_path + '/yell.yml' } let(:config) { Yell::Configuration.load!(file) } diff --git a/spec/yell/event_spec.rb b/spec/yell/event_spec.rb index 25a714a..c4a322b 100644 --- a/spec/yell/event_spec.rb +++ b/spec/yell/event_spec.rb @@ -20,17 +20,17 @@ def self._event(logger, level, message) let(:logger) { Yell::Logger.new(:trace => true) } let(:event) { Yell::Event.new(logger, 1, 'Hello World!') } - context ":level" do + context "#level" do subject { event.level } it { should eq(1) } end - context ":messages" do + context "#messages" do subject { event.messages } it { should eq(['Hello World!']) } end - context ":time" do + context "#time" do let(:time) { Time.now } subject { event.time.to_s } @@ -39,17 +39,17 @@ def self._event(logger, level, message) it { should eq(time.to_s) } end - context ":hostname" do + context "#hostname" do subject { event.hostname } it { should eq(Socket.gethostname) } end - context ":pid" do + context "#pid" do subject { event.pid } it { should eq(Process.pid) } end - context "pid when forked", :pending => RUBY_PLATFORM == 'java' ? "No forking with jruby" : false do + context "#id when forked", :pending => RUBY_PLATFORM == 'java' ? "No forking with jruby" : false do subject { @pid } before do @@ -70,7 +70,7 @@ def self._event(logger, level, message) it { should eq(@child_pid) } end - context ":progname" do + context "#progname" do subject { event.progname } it { should eq($0) } end diff --git a/spec/yell/level_spec.rb b/spec/yell/level_spec.rb index 5c50ab6..03f3a06 100644 --- a/spec/yell/level_spec.rb +++ b/spec/yell/level_spec.rb @@ -195,5 +195,6 @@ expect(severities[level]).to eq("WARNING") end end + end diff --git a/spec/yell/logger_spec.rb b/spec/yell/logger_spec.rb index f3ea4fd..6b27fa6 100644 --- a/spec/yell/logger_spec.rb +++ b/spec/yell/logger_spec.rb @@ -41,21 +41,21 @@ def bar it { should respond_to(:unknown?) } end - context "default adapters" do + context "default #adapters" do subject { logger.adapters } its(:size) { should eq(1) } its(:first) { should be_kind_of(Yell::Adapters::File) } end - context "default :level" do + context "default #level" do subject { logger.level } it { should be_instance_of(Yell::Level) } its(:severities) { should eq([true, true, true, true, true, true]) } end - context "default :trace" do + context "default #trace" do subject { logger.trace } it { should be_instance_of(Yell::Level) } @@ -63,7 +63,7 @@ def bar end end - describe "initialize with :name" do + describe "initialize with #name" do let(:name) { 'test' } let!(:logger) { Yell.new(:name => name) } @@ -72,7 +72,7 @@ def bar end end - context "initialize with :level" do + context "initialize with #level" do let(:level) { :error } let(:logger) { Yell.new(:level => level) } subject { logger.level } @@ -81,7 +81,7 @@ def bar its(:severities) { should eq([false, false, false, true, true, true]) } end - context "initialize with :trace" do + context "initialize with #trace" do let(:trace) { :info } let(:logger) { Yell.new(:trace => trace) } subject { logger.trace } @@ -90,7 +90,7 @@ def bar its(:severities) { should eq([false, true, true, true, true, true]) } end - context "initialize with :silence" do + context "initialize with #silence" do let(:silence) { "test" } let(:logger) { Yell.new(:silence => silence) } subject { logger.silencer } @@ -99,7 +99,7 @@ def bar its(:patterns) { should eq([silence]) } end - context "initialize with a :filename" do + context "initialize with a #filename" do it "should call adapter with :file" do mock.proxy(Yell::Adapters::File).new(:filename => filename) @@ -107,7 +107,7 @@ def bar end end - context "initialize with a :filename of Pathname type" do + context "initialize with a #filename of Pathname type" do let(:pathname) { Pathname.new(filename) } it "should call adapter with :file" do @@ -167,7 +167,7 @@ def bar end end - context "initialize with :adapters option" do + context "initialize with #adapters option" do let(:logger) do Yell::Logger.new(:adapters => [:stdout, {:stderr => {:level => :error}}]) end diff --git a/spec/yell/repository_spec.rb b/spec/yell/repository_spec.rb index a274d53..818524b 100644 --- a/spec/yell/repository_spec.rb +++ b/spec/yell/repository_spec.rb @@ -40,14 +40,14 @@ it { should eq(logger) } end - context "[]= with a named logger" do + context ".[]= with a named logger" do let!(:logger) { Yell.new(:stdout, :name => name) } before { Yell::Repository[name] = logger } it { should eq(logger) } end - context "[]= with a named logger of a different name" do + context ".[]= with a named logger of a different name" do let(:other) { 'other' } let(:logger) { Yell.new(:stdout, :name => other) } before { Yell::Repository[name] = logger } diff --git a/spec/yell/silencer_spec.rb b/spec/yell/silencer_spec.rb index 419cbf6..dacb0e3 100644 --- a/spec/yell/silencer_spec.rb +++ b/spec/yell/silencer_spec.rb @@ -2,13 +2,13 @@ describe Yell::Silencer do - context "initialize with :patterns" do + context "initialize with #patterns" do subject { Yell::Silencer.new(/this/) } its(:patterns) { should eq([/this/]) } end - context "add" do + context "#add" do let(:silencer) { Yell::Silencer.new } it "should add patterns" do @@ -24,7 +24,7 @@ end end - context "silence?" do + context "#silence?" do let(:silencer) { Yell::Silencer.new } it "should be false when no patterns present" do @@ -38,11 +38,12 @@ end end - context "silence" do + context "#silence" do let(:silencer) { Yell::Silencer.new(/this/) } it "should reject messages that match any pattern" do expect(silencer.silence("this", "that")).to eq(["that"]) end end + end diff --git a/spec/yell_spec.rb b/spec/yell_spec.rb index 67ec179..9f953c4 100644 --- a/spec/yell_spec.rb +++ b/spec/yell_spec.rb @@ -13,17 +13,17 @@ }.to raise_error(Yell::AdapterNotFound) end - context ":level" do + context ".level" do subject { Yell.level } it { should be_kind_of Yell::Level } end - context ":format" do + context ".format" do subject { Yell.format( "%m" ) } it { should be_kind_of Yell::Formatter } end - context ":load!" do + context ".load!" do subject { Yell.load!( 'yell.yml' ) } before do @@ -33,7 +33,7 @@ it { should be_kind_of Yell::Logger } end - context ":[]" do + context ".[]" do let(:name) { 'test' } it "should delegate to the repository" do @@ -43,7 +43,7 @@ end end - context ":[]=" do + context ".[]=" do let(:name) { 'test' } it "should delegate to the repository" do @@ -53,7 +53,7 @@ end end - context ":env" do + context ".env" do subject { Yell.env } it "should default to YELL_ENV" do