From a8c7c727bbc87f96aff8811faf107405c057d3d7 Mon Sep 17 00:00:00 2001 From: alter-al <33gri@bk.ru> Date: Mon, 6 Aug 2018 15:00:42 +0300 Subject: [PATCH] ISSUE-1: refactoring --- lib/skeleton.rb | 7 ++----- lib/skeleton/languages.rb | 6 +++++- lib/skeleton/version.rb | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/skeleton.rb b/lib/skeleton.rb index 3d6f7ec..31f132d 100644 --- a/lib/skeleton.rb +++ b/lib/skeleton.rb @@ -30,7 +30,6 @@ def platform=(platform) end def run - @driver.clear @driver.precondition @driver.skeletoner fill_html @@ -38,12 +37,10 @@ def run end def fill_html - language = Language.new - languages = %w[ruby java python javascript] - languages += %w[swift] if ios? + languages = ios? ? Language.all : Language.all - ['swift'] languages.each do |lang| attach_image - type = language.type(lang) + type = Language.domain(lang) folder = Base::PAGE_OBJECTS_FOLDER @screen_objects = File.read(Dir["#{folder}/*.#{type}"].first) @elements_tree = File.read(Dir["#{folder}/*.xml"].first) diff --git a/lib/skeleton/languages.rb b/lib/skeleton/languages.rb index 2da6a33..cc6ce1e 100644 --- a/lib/skeleton/languages.rb +++ b/lib/skeleton/languages.rb @@ -49,7 +49,7 @@ def swift(camel_method_name:, element_type:, locator_value:, accessibility_id:) end end - def type(format) + def self.domain(format) case format when 'ruby', 'rb' RUBY @@ -65,6 +65,10 @@ def type(format) "I haven't this language format" end end + + def self.all + %w[ruby java python javascript swift] + end end class XCUIElement diff --git a/lib/skeleton/version.rb b/lib/skeleton/version.rb index 34654d2..db012f6 100644 --- a/lib/skeleton/version.rb +++ b/lib/skeleton/version.rb @@ -1,4 +1,4 @@ module Skeleton - VERSION ||= '0.1.12'.freeze + VERSION ||= '0.1.13'.freeze GEM_NAME ||= 'skeleton-ui'.freeze end