mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-12 09:17:05 +02:00
Follow rspec 2.99
This commit is contained in:
parent
31f63320a6
commit
7bf5aa2a2e
@ -29,7 +29,7 @@ describe Fluentd::Agent do
|
||||
end
|
||||
|
||||
describe "#recent_errors" do
|
||||
before { instance.stub(:log_file).and_return { logfile } }
|
||||
before { instance.stub(:log_file).and_return(logfile) }
|
||||
|
||||
context "have 0 error log" do
|
||||
let(:logfile) { File.expand_path("./spec/support/fixtures/error0.log", Rails.root) }
|
||||
@ -88,14 +88,14 @@ describe Fluentd::Agent do
|
||||
end
|
||||
|
||||
describe "#start" do
|
||||
before { instance.stub(:running?).and_return { running } }
|
||||
before { instance.stub(:running?).and_return(running) }
|
||||
|
||||
context "running" do
|
||||
let(:running) { true }
|
||||
|
||||
subject { instance.start }
|
||||
|
||||
it { should be_true }
|
||||
it { should be_truthy }
|
||||
end
|
||||
|
||||
context "not running" do
|
||||
@ -104,52 +104,52 @@ describe Fluentd::Agent do
|
||||
subject { instance.start }
|
||||
|
||||
before do
|
||||
instance.stub(:actual_start).and_return { start_result }
|
||||
instance.stub(:actual_start).and_return(start_result)
|
||||
end
|
||||
|
||||
context "actual start success" do
|
||||
let(:start_result) { true }
|
||||
it { should be_true }
|
||||
it { should be_truthy }
|
||||
end
|
||||
|
||||
context "actual start failed" do
|
||||
let(:start_result) { false }
|
||||
it { should be_false }
|
||||
it { should be_falsy }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#stop" do
|
||||
before { instance.stub(:running?).and_return { running } }
|
||||
before { instance.stub(:running?).and_return(running) }
|
||||
|
||||
subject { instance.stop }
|
||||
|
||||
context "running" do
|
||||
let(:running) { true }
|
||||
|
||||
before { instance.stub(:actual_stop).and_return { stop_result } }
|
||||
before { instance.stub(:actual_stop).and_return(stop_result) }
|
||||
|
||||
context "actual stop success" do
|
||||
let(:stop_result) { true }
|
||||
it { should be_true }
|
||||
it { should be_truthy }
|
||||
end
|
||||
|
||||
context "actual stop failed" do
|
||||
let(:stop_result) { false }
|
||||
it { should be_false }
|
||||
it { should be_falsy }
|
||||
end
|
||||
end
|
||||
|
||||
context "not running" do
|
||||
let(:running) { false }
|
||||
|
||||
it { should be_true }
|
||||
it { should be_truthy }
|
||||
end
|
||||
end
|
||||
|
||||
describe "#restart" do
|
||||
before { instance.stub(:stop).and_return { stop_result } }
|
||||
before { instance.stub(:start).and_return { start_result } }
|
||||
before { instance.stub(:stop).and_return(stop_result) }
|
||||
before { instance.stub(:start).and_return(start_result) }
|
||||
subject { instance.restart }
|
||||
|
||||
describe "return true only if #stop and #start success" do
|
||||
@ -158,12 +158,12 @@ describe Fluentd::Agent do
|
||||
|
||||
context" #start success" do
|
||||
let(:start_result) { true }
|
||||
it { should be_true }
|
||||
it { should be_truthy }
|
||||
end
|
||||
|
||||
context" #start fail" do
|
||||
let(:start_result) { false }
|
||||
it { should be_false }
|
||||
it { should be_falsy }
|
||||
end
|
||||
end
|
||||
|
||||
@ -172,12 +172,12 @@ describe Fluentd::Agent do
|
||||
|
||||
context" #start success" do
|
||||
let(:start_result) { true }
|
||||
it { should be_false }
|
||||
it { should be_falsy }
|
||||
end
|
||||
|
||||
context" #start fail" do
|
||||
let(:start_result) { false }
|
||||
it { should be_false }
|
||||
it { should be_falsy }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -154,12 +154,12 @@ describe Fluentd do
|
||||
|
||||
context "doesn't exists" do
|
||||
before { File.unlink(config_file) if File.exist?(config_file) }
|
||||
it { File.exist?(subject).should be_true }
|
||||
it { File.exist?(subject).should be_truthy }
|
||||
end
|
||||
|
||||
context "already exists" do
|
||||
before { FileUtils.touch(config_file) }
|
||||
it { File.exist?(subject).should be_true }
|
||||
it { File.exist?(subject).should be_truthy }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -17,13 +17,13 @@ describe LoginToken do
|
||||
describe "#active" do
|
||||
subject { LoginToken.active }
|
||||
it { subject.count.should == active }
|
||||
it { subject.all?{|t| t.expired_at > Time.now}.should be_true }
|
||||
it { subject.all?{|t| t.expired_at > Time.now}.should be_truthy }
|
||||
end
|
||||
|
||||
describe "#inactive" do
|
||||
subject { LoginToken.inactive }
|
||||
it { subject.count.should == inactive }
|
||||
it { subject.all?{|t| t.expired_at <= Time.now}.should be_true }
|
||||
it { subject.all?{|t| t.expired_at <= Time.now}.should be_truthy }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ describe Plugin do
|
||||
let(:plugin) { build(:plugin) }
|
||||
|
||||
before do
|
||||
Plugin.stub(:gemfile_path).and_return { Rails.root + "tmp/fluentd-ui-test-gemfile.plugins" }
|
||||
Plugin.stub(:gemfile_path).and_return(Rails.root + "tmp/fluentd-ui-test-gemfile.plugins" )
|
||||
end
|
||||
|
||||
after do
|
||||
@ -51,8 +51,8 @@ describe Plugin do
|
||||
describe "#install!" do
|
||||
describe "invoke fluent_gem" do
|
||||
after do
|
||||
plugin.stub(:valid?).and_return { valid }
|
||||
plugin.stub(:installed?).and_return { installed }
|
||||
plugin.stub(:valid?).and_return(valid)
|
||||
plugin.stub(:installed?).and_return(installed)
|
||||
plugin.install!
|
||||
end
|
||||
|
||||
@ -86,7 +86,7 @@ describe Plugin do
|
||||
end
|
||||
|
||||
context "system command error" do
|
||||
before { plugin.should_receive(:system).and_return { false } }
|
||||
before { plugin.should_receive(:system).and_return(false) }
|
||||
subject { expect { plugin.install! } }
|
||||
|
||||
it "raise GemError" do
|
||||
@ -100,7 +100,7 @@ describe Plugin do
|
||||
|
||||
describe "after install succeed" do
|
||||
before do
|
||||
plugin.stub(:fluent_gem).and_return { true }
|
||||
plugin.stub(:fluent_gem).and_return(true)
|
||||
plugin.install!
|
||||
end
|
||||
|
||||
@ -113,7 +113,7 @@ describe Plugin do
|
||||
let(:installed_plugin) { build(:plugin, gem_name: "fluent-plugin-foobar") }
|
||||
|
||||
before do
|
||||
installed_plugin.stub(:fluent_gem).and_return { true }
|
||||
installed_plugin.stub(:fluent_gem).and_return(true)
|
||||
installed_plugin.install!
|
||||
Plugin.pristine!
|
||||
end
|
||||
@ -132,7 +132,7 @@ describe Plugin do
|
||||
let(:target_version) { "1.2.0" }
|
||||
|
||||
before do
|
||||
Plugin.any_instance.stub(:fluent_gem).and_return { true } # NOTE: not `plugin.stub` because upgrade! creates new Plugin instance internally
|
||||
Plugin.any_instance.stub(:fluent_gem).and_return(true) # NOTE: not `plugin.stub` because upgrade! creates new Plugin instance internally
|
||||
installed_plugin.install!
|
||||
Plugin.pristine!
|
||||
installed_plugin.upgrade!(target_version)
|
||||
@ -145,7 +145,7 @@ describe Plugin do
|
||||
|
||||
describe ".installed" do
|
||||
before do
|
||||
plugin.stub(:fluent_gem).and_return { true }
|
||||
plugin.stub(:fluent_gem).and_return(true)
|
||||
plugin.install!
|
||||
end
|
||||
|
||||
@ -159,7 +159,7 @@ describe Plugin do
|
||||
let(:gem_version) { Gem::Version.new("1.0.0") }
|
||||
|
||||
before do
|
||||
plugin.stub(:installed_version).and_return { gem_version.to_s }
|
||||
plugin.stub(:installed_version).and_return(gem_version.to_s)
|
||||
stub_request(:get, /rubygems.org/).to_return(body: JSON.dump(api_response))
|
||||
end
|
||||
|
||||
@ -170,7 +170,7 @@ describe Plugin do
|
||||
[{number: gem_version.bump}, {number: gem_version}]
|
||||
end
|
||||
|
||||
it { subject.should be_false }
|
||||
it { subject.should be_falsy }
|
||||
end
|
||||
|
||||
context "unavailable updates" do
|
||||
@ -178,13 +178,13 @@ describe Plugin do
|
||||
[{number: gem_version}]
|
||||
end
|
||||
|
||||
it { subject.should be_true }
|
||||
it { subject.should be_truthy }
|
||||
end
|
||||
end
|
||||
|
||||
describe "#installed_version" do
|
||||
before do
|
||||
Plugin.any_instance.stub(:fluent_gem).and_return { true } # NOTE: not `plugin.stub` because upgrade! creates new Plugin instance internally
|
||||
Plugin.any_instance.stub(:fluent_gem).and_return(true) # NOTE: not `plugin.stub` because upgrade! creates new Plugin instance internally
|
||||
plugin.install!
|
||||
end
|
||||
|
||||
|
@ -55,6 +55,9 @@ RSpec.configure do |config|
|
||||
# --seed 1234
|
||||
config.order = "random"
|
||||
|
||||
# rspec 2.99
|
||||
config.infer_spec_type_from_file_location!
|
||||
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.strategy = :transaction
|
||||
DatabaseCleaner.clean_with(:truncation)
|
||||
|
Loading…
Reference in New Issue
Block a user