mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 10:56:11 +02:00
Add specs for newer fluentd-ui available check and popup
This commit is contained in:
parent
844d867a52
commit
e79ebf7da0
@ -1,4 +1,6 @@
|
||||
unless FluentdUI.td_agent_ui?
|
||||
# td-agent-ui shouldn't auto update
|
||||
FluentdUiUpdateCheck.new.async.perform
|
||||
unless Rails.env.test?
|
||||
unless FluentdUI.td_agent_ui?
|
||||
# td-agent-ui shouldn't auto update
|
||||
FluentdUiUpdateCheck.new.async.perform
|
||||
end
|
||||
end
|
||||
|
||||
33
spec/features/fluentd_ui_update_available_spec.rb
Normal file
33
spec/features/fluentd_ui_update_available_spec.rb
Normal file
@ -0,0 +1,33 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "fluentd-ui updates checking" do
|
||||
let(:exists_user) { build(:user) }
|
||||
before { login_with(exists_user) }
|
||||
|
||||
describe "Show popup if newer version is available" do
|
||||
let(:version) { "9999.99" }
|
||||
let(:message) { I18n.t("messages.available_new_fluentd_ui", version: FluentdUI.latest_version, update_url: misc_information_path, title: "dummy") }
|
||||
before { FluentdUI.latest_version = version }
|
||||
after { FluentdUI.latest_version = ::FluentdUI::VERSION }
|
||||
|
||||
it do
|
||||
visit root_path
|
||||
page.should have_css('.alert-info')
|
||||
page.should have_content(version)
|
||||
page.body.should include(message)
|
||||
end
|
||||
end
|
||||
|
||||
describe "Not shown popup if newer version is not available" do
|
||||
let(:version) { ::FluentdUI::VERSION }
|
||||
let(:message) { I18n.t("messages.available_new_fluentd_ui", version: FluentdUI.latest_version, update_url: misc_information_path, title: "dummy") }
|
||||
|
||||
it do
|
||||
visit root_path
|
||||
page.should_not have_css('.alert-info')
|
||||
page.should_not have_content(version)
|
||||
page.body.should_not include(message)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@ -1,6 +1,6 @@
|
||||
describe "users" do
|
||||
let(:exists_user) { create(:user) }
|
||||
require "spec_helper"
|
||||
|
||||
describe "users" do
|
||||
describe "edit" do
|
||||
let(:url) { user_path }
|
||||
it_should_behave_like "login required"
|
||||
|
||||
@ -33,6 +33,7 @@ RSpec.configure do |config|
|
||||
|
||||
# Syntax sugar to use the FactoryGirl methods directly instead FactoryGirl.create ete.
|
||||
config.include FactoryGirl::Syntax::Methods
|
||||
config.include LoginMacro
|
||||
|
||||
# If true, the base class of anonymous controllers will be inferred
|
||||
# automatically. This will be the default behavior in future versions of
|
||||
|
||||
10
spec/support/login_macro.rb
Normal file
10
spec/support/login_macro.rb
Normal file
@ -0,0 +1,10 @@
|
||||
module LoginMacro
|
||||
def login_with(user)
|
||||
visit '/sessions/new'
|
||||
within("form") do
|
||||
fill_in 'session_name', :with => exists_user.name
|
||||
fill_in 'session_password', :with => exists_user.password
|
||||
end
|
||||
click_button I18n.t("terms.sign_in")
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user