Skip to content

Commit

Permalink
Update from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Sep 20, 2018
1 parent 53a5cf5 commit 6b82ddb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/lib/y2firewall/widgets/interfaces_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def opt
# @macro seeAbstractWidget
def init
interface = Y2Firewall::UIState.instance.row_id
if interface && interfaces.map(&:name).include?(interface.to_s)
if interface && interfaces.map(&:id).include?(interface)
self.value = interface
end
change_zone_button.interface = selected_interface
Expand All @@ -71,7 +71,7 @@ def header
def items
interfaces.map do |iface|
[
iface.name.to_sym,
iface.id,
iface.name,
iface.zone ? iface.zone.name : DEFAULT_ZONE_NAME,
iface.device_name
Expand All @@ -88,7 +88,7 @@ def handle(event)
end

def selected_interface
interfaces.find { |i| i.name == value.to_s }
interfaces.find { |i| i.id == value }
end

private
Expand Down
6 changes: 4 additions & 2 deletions test/lib/y2firewall/widgets/interfaces_table_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@

let(:eth0) do
instance_double(
Y2Firewall::Firewalld::Interface, name: "eth0", device_name: DEVICE_NAME, zone: public_zone
Y2Firewall::Firewalld::Interface, id: :eth0, name: "eth0",
device_name: DEVICE_NAME, zone: public_zone
)
end

let(:eth1) do
instance_double(
Y2Firewall::Firewalld::Interface, name: "eth1", device_name: DEVICE_NAME, zone: nil
Y2Firewall::Firewalld::Interface, id: :eth1, name: "eth1",
device_name: DEVICE_NAME, zone: nil
)
end

Expand Down

0 comments on commit 6b82ddb

Please sign in to comment.