Skip to content

Commit

Permalink
Apply to RSpec3
Browse files Browse the repository at this point in the history
  • Loading branch information
pinzolo committed Jun 23, 2014
1 parent 823afef commit 47013f1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 49 deletions.
58 changes: 29 additions & 29 deletions spec/logdup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ def include_message?(lines, message)
lines = File.readlines(log_file("base-on-single"))
syms.each do |sym|
1.upto(3) do |i|
expect(include_message?(lines, "#{sym}-0#{i}")).to be_true
expect(include_message?(lines, "#{sym}-0#{i}")).to be_truthy
end
end
end
it "logged partially in single.log" do
lines = File.readlines(log_file("single"))
syms.each do |sym|
expect(include_message?(lines, "#{sym}-01")).to be_false
expect(include_message?(lines, "#{sym}-02")).to be_true
expect(include_message?(lines, "#{sym}-03")).to be_false
expect(include_message?(lines, "#{sym}-01")).to be_falsy
expect(include_message?(lines, "#{sym}-02")).to be_truthy
expect(include_message?(lines, "#{sym}-03")).to be_falsy
end
end
end
Expand Down Expand Up @@ -82,28 +82,28 @@ def include_message?(lines, message)
lines = File.readlines(log_file("base-on-nested"))
syms.each do |sym|
1.upto(5) do |i|
expect(include_message?(lines, "#{sym}-0#{i}")).to be_true
expect(include_message?(lines, "#{sym}-0#{i}")).to be_truthy
end
end
end
it "logged partially in nested-outer.log" do
lines = File.readlines(log_file("nested-outer"))
syms.each do |sym|
expect(include_message?(lines, "#{sym}-01")).to be_false
expect(include_message?(lines, "#{sym}-02")).to be_true
expect(include_message?(lines, "#{sym}-03")).to be_true
expect(include_message?(lines, "#{sym}-04")).to be_true
expect(include_message?(lines, "#{sym}-05")).to be_false
expect(include_message?(lines, "#{sym}-01")).to be_falsy
expect(include_message?(lines, "#{sym}-02")).to be_truthy
expect(include_message?(lines, "#{sym}-03")).to be_truthy
expect(include_message?(lines, "#{sym}-04")).to be_truthy
expect(include_message?(lines, "#{sym}-05")).to be_falsy
end
end
it "logged partially in nested-inner.log" do
lines = File.readlines(log_file("nested-inner"))
syms.each do |sym|
expect(include_message?(lines, "#{sym}-01")).to be_false
expect(include_message?(lines, "#{sym}-02")).to be_false
expect(include_message?(lines, "#{sym}-03")).to be_true
expect(include_message?(lines, "#{sym}-04")).to be_false
expect(include_message?(lines, "#{sym}-05")).to be_false
expect(include_message?(lines, "#{sym}-01")).to be_falsy
expect(include_message?(lines, "#{sym}-02")).to be_falsy
expect(include_message?(lines, "#{sym}-03")).to be_truthy
expect(include_message?(lines, "#{sym}-04")).to be_falsy
expect(include_message?(lines, "#{sym}-05")).to be_falsy
end
end
end
Expand All @@ -127,17 +127,17 @@ def include_message?(lines, message)
it "logged all in base-on-thread.log" do
lines = File.readlines(log_file("base-on-thread"))
1.upto(5) do |i|
expect(include_message?(lines, "info-0#{i}")).to be_true
expect(include_message?(lines, "info-0#{i}")).to be_truthy
end
end
it "logged at same thread in thread.log" do
lines = File.readlines(log_file("thread"))
syms.each do |sym|
expect(include_message?(lines, "info-01")).to be_false
expect(include_message?(lines, "info-02")).to be_false
expect(include_message?(lines, "info-03")).to be_true
expect(include_message?(lines, "info-04")).to be_false
expect(include_message?(lines, "info-05")).to be_false
expect(include_message?(lines, "info-01")).to be_falsy
expect(include_message?(lines, "info-02")).to be_falsy
expect(include_message?(lines, "info-03")).to be_truthy
expect(include_message?(lines, "info-04")).to be_falsy
expect(include_message?(lines, "info-05")).to be_falsy
end
end
end
Expand All @@ -147,18 +147,18 @@ def include_message?(lines, message)
logger.dup_to(log_file("buffer"), buffer_size: 2) do
logger.info("info-01")
logger.info("info-02")
expect(File.exists?(log_file("buffer"))).to be_false
expect(File.exists?(log_file("buffer"))).to be_falsy
logger.info("info-03")
expect(File.exists?(log_file("buffer"))).to be_true
expect(File.exists?(log_file("buffer"))).to be_truthy
lines = File.readlines(log_file("buffer"))
expect(include_message?(lines, "info-01")).to be_true
expect(include_message?(lines, "info-02")).to be_false
expect(include_message?(lines, "info-03")).to be_false
expect(include_message?(lines, "info-01")).to be_truthy
expect(include_message?(lines, "info-02")).to be_falsy
expect(include_message?(lines, "info-03")).to be_falsy
end
lines = File.readlines(log_file("buffer"))
expect(include_message?(lines, "info-01")).to be_true
expect(include_message?(lines, "info-02")).to be_true
expect(include_message?(lines, "info-03")).to be_true
expect(include_message?(lines, "info-01")).to be_truthy
expect(include_message?(lines, "info-02")).to be_truthy
expect(include_message?(lines, "info-03")).to be_truthy
end
end
end
Expand Down
20 changes: 0 additions & 20 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# coding: utf-8
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# Require this file using `require "spec_helper"` to ensure that it is only
# loaded once.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
require "coveralls"
require "simplecov"
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
Expand All @@ -13,16 +6,3 @@
add_filter '/bundle/'
end
require 'logdup'

RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus

# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = 'random'
end

0 comments on commit 47013f1

Please sign in to comment.