Skip to content

Commit d65a610

Browse files
committed
convert console_supported? to supports?
- moving all supports into provider classes - moving :console from vm_or_template to vm/operations with the rest of them. - explicitly stating html5_console and console - native_console had half in supports and half in console_supported. so less of a change - dropping console_supported?
1 parent 0667484 commit d65a610

File tree

2 files changed

+0
-49
lines changed

2 files changed

+0
-49
lines changed

app/models/vm_or_template.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,10 +1608,6 @@ def add_ems_event(event_type, event_message, event_timestamp)
16081608
EmsEvent.add(ems_id, event)
16091609
end
16101610

1611-
def console_supported?(_type)
1612-
false
1613-
end
1614-
16151611
# Stop certain charts from showing unless the subclass allows
16161612
def non_generic_charts_available?
16171613
false
@@ -1670,8 +1666,6 @@ def tenant_identity
16701666
user
16711667
end
16721668

1673-
supports(:console) { N_("Console not supported") unless console_supported?('spice') || console_supported?('vnc') }
1674-
16751669
def child_resources
16761670
children
16771671
end

spec/models/vm/operations_spec.rb

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -53,49 +53,6 @@
5353
end
5454
end
5555

56-
describe '#supports?(:vmrc_console)' do
57-
it 'returns false if type is not supported' do
58-
allow(@vm).to receive(:console_supported?).with('VMRC').and_return(false)
59-
60-
expect(@vm.supports?(:vmrc_console)).to be_falsey
61-
expect(@vm.unsupported_reason(:vmrc_console)).to include('VMRC Console not supported')
62-
end
63-
64-
it 'supports it if all conditions are met' do
65-
allow(@vm).to receive(:console_supported?).with('VMRC').and_return(true)
66-
67-
expect(@vm.supports?(:vmrc_console)).to be_truthy
68-
end
69-
end
70-
71-
describe '#supports?(:html5_console)' do
72-
it 'supports it if all conditions are met' do
73-
allow(@vm).to receive(:console_supported?).and_return(true)
74-
expect(@vm.supports?(:html5_console)).to be_truthy
75-
end
76-
77-
it 'returns false if type is not supported' do
78-
allow(@vm).to receive(:console_supported?).and_return(false)
79-
expect(@vm.supports?(:html5_console)).to be_falsey
80-
expect(@vm.unsupported_reason(:html5_console)).to include('HTML5 Console is not supported')
81-
end
82-
end
83-
84-
describe '#supports?(:native_console)' do
85-
it 'returns false if type is not supported' do
86-
allow(@vm).to receive(:console_supported?).with('NATIVE').and_return(false)
87-
88-
expect(@vm.supports?(:native_console)).to be_falsey
89-
expect(@vm.unsupported_reason(:native_console)).to include('NATIVE Console not supported')
90-
end
91-
92-
it 'supports it if all conditions are met' do
93-
allow(@vm).to receive(:console_supported?).with('NATIVE').and_return(true)
94-
95-
expect(@vm.supports?(:native_console)).to be_truthy
96-
end
97-
end
98-
9956
describe '#supports?(:launch_vmrc_console)' do
10057
it 'does not support it if validate_remote_console_vmrc_support raises an error' do
10158
allow(@vm).to receive(:validate_remote_console_vmrc_support).and_raise(StandardError)

0 commit comments

Comments
 (0)