Skip to content

Instantly share code, notes, and snippets.

View wellavelino's full-sized avatar
🎧
Focusing

Wellington Avelino dos Santos wellavelino

🎧
Focusing
View GitHub Profile
# Lint class
class Lint
def even_numbers
numbers_list = [30, 434, 10, 4, 6, 9, 98, 7, 14, 21]
numbers_list.each do |number|
puts 'Even number', number if number.even?
end
end
end
15:19 $ rubocop lint.rb -f offenses -f clang
--
0 Total
@wellavelino
wellavelino / lint.rb
Last active November 28, 2017 17:15
Simple output from lint class
lint.rb:1:1: W: Script file lint.rb doesn't have execute permission.
#!/usr/bin/env ruby
^^^^^^^^^^^^^^^^^^^
lint.rb:2:1: C: Missing top-level class documentation comment.
class Lint
^^^^^
lint.rb:3:1: C: Use 2 (not 0) spaces for indentation.
def get_even_numbers
lint.rb:3:5: C: Do not prefix reader method names with get_.
@wellavelino
wellavelino / rubocop.yml
Last active November 28, 2017 17:36
Configured Rubocop file to run on ruby test projects
Documentation:
Enabled: false
AllCops:
Include:
- '**/Rakefile'
Exclude:
- 'step_definitions/**'
- 'screenshots/**/*'
- '*.feature'
@wellavelino
wellavelino / start_emulator.sh
Last active November 23, 2017 19:40
workaround to fix start emualator on command line
#!/bin/bash
# change the folder to /tools
cd $(dirname $(which emulator)) && ./emulator -avd Droid22 > /dev/null &
cd
@wellavelino
wellavelino / compare.rb
Last active November 22, 2017 19:06 — forked from mashhoodr/compare.rb
Comparing images in cucumber - calabash
require 'oily_png'
require 'open-uri'
include ChunkyPNG::Color
def starts_with(item, prefix)
prefix = prefix.to_s
item[0, prefix.length] == prefix
end
# compares two images on disk, returns the % difference
@wellavelino
wellavelino / fix_instalation_imagemagik.rb
Created November 12, 2017 21:13
imagemagik fix instalation
brew install pkg-config
brew uninstall imagemagick
brew install imagemagick@6
brew link imagemagick@6 --force
@wellavelino
wellavelino / appium_install.md
Last active November 8, 2017 13:12
Appium install

Configuração Appium (Ruby lib)

Atualizar versão do Ruby para 2.2++

rbenv install 'versão do ruby'

Instalar/Atualizar o node na máquina

@wellavelino
wellavelino / appium_calabash_commands.md
Created November 8, 2017 13:11
commands to inspect elements

Appium commands

driver.rotate :landscape

driver.rotate :portrait

find_element(id:'title').text = retorna o texto do elemento

find_element(id:'title').name = retorna o texto do elemento

@wellavelino
wellavelino / nokogiri_example.rb
Created September 26, 2017 20:37
nokogiri_example.rb
def expirate_code
sms_code = []
page = Nokogiri::HTML(open(CHANNEL_MANAGER,
http_basic_authentication:
[CREDENTIALS[:channel_manager][:login],
CREDENTIALS[:channel_manager][:password]]))
page.search('pre').each do |sms|
sms_code << sms.to_s.tr('<pre>', '')