Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable to inject settings_gist_id instead of the settings #63

Merged
merged 4 commits into from
Aug 6, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Silence stdout
  • Loading branch information
masutaka committed Aug 6, 2017
commit 66324a71bd9103a09242874ceabe471646c08e75
15 changes: 15 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -22,6 +22,9 @@
RSpec.configure do |config|
config.include LoadFixtureHelper

config.before(:all) { silence_stdout }
config.after(:all){ enable_stdout }
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Github::Nippou::Settings#data で puts しており、rspec の結果が Noisy になるため。YAML syntax error は発生しやすいと思うので、親切に教えてあげたい。

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いわゆる printf デバッグできないのでリバートしました...。→ 7a75ef5


# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
@@ -106,3 +109,15 @@
Kernel.srand config.seed
=end
end

# Redirects stdout to /dev/null.
def silence_stdout
@orig_stdout = $stdout
$stdout = File.new('/dev/null', 'w')
end

# Replace stdout so anything else is output correctly.
def enable_stdout
$stdout = @orig_stdout
@orig_stdout = nil
end