-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Attila Vecerek
committed
Feb 23, 2017
1 parent
c4d4d2b
commit b277753
Showing
5 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ApplicationHelper::Button::DbRefresh < ApplicationHelper::Button::Basic | ||
include ApplicationHelper::Button::Mixins::ActiveContextMixin | ||
|
||
def visible? | ||
active_tab?(%w(db_connections db_details db_indexes db_settings)) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
spec/helpers/application_helper/buttons/db_refresh_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
describe ApplicationHelper::Button::DbRefresh do | ||
let(:view_context) { setup_view_context_with_sandbox(:active_tab => tab) } | ||
let(:button) { described_class.new(view_context, {}, {}, {}) } | ||
|
||
describe '#visible?' do | ||
subject { button.visible? } | ||
%w(db_details db_indexes db_settings db_connections).each do |tree| | ||
context "when active_tree == #{tree}" do | ||
let(:tab) { tree } | ||
it { expect(subject).to be_truthy } | ||
end | ||
end | ||
context 'when !active_tree.in?(%w(db_details db_indexes db_settings db_connections))' do | ||
let(:tab) { 'something_else' } | ||
it { expect(subject).to be_falsey } | ||
end | ||
end | ||
end |