Skip to content

Instantly share code, notes, and snippets.

View rafaellima's full-sized avatar

Rafael Lima rafaellima

View GitHub Profile
@rafaellima
rafaellima / test_spec.rb
Created June 19, 2018 09:48
spec_helper vs rails_helper
# frozen_string_literal: true
require "spec_helper"
require_relative "../../../../lib/client.rb"
require_relative "../../../../lib/platform.rb"
class Settings
def self.m1; end
def self.m2; end
@rafaellima
rafaellima / emacs.org
Created May 9, 2018 11:33
Emacs techbrownbag
@rafaellima
rafaellima / class2
Last active April 26, 2018 09:46
German course - 2
** 18.05.2018
- On repeating statements
Noch einmal, bitte! Again, please!
Kannst du das wiederholen? Can you repeat?
- About Woher and wohnen
Woher kommst du? Ich komme aus ...
Wo wohnen Sie? Ich wohne in...
@rafaellima
rafaellima / deal_creator.rb
Last active April 18, 2018 13:55
deal playground
def module Domain::DealCreator
def new(params)
@deal = Deal.new(deal)
end
def save(deal_params)
deal = Deal.new(deal)
default_time
info
@rafaellima
rafaellima / money.clj
Last active September 27, 2022 14:52
Money
(ns ch1.money)
(declare validate-same-currency)
(defrecord Currency [divisor sym desc])
(defrecord Money [amount ^Currency currency]
java.lang.Comparable
(compareTo [m1 m2]
(validate-same-currency m1 m2)
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
found = false
(1..5).each do |index|
sleep 1
os_name = (@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[1]/span[2]").text)
if os_name == "\"Linux Debian 7\""
!60.times{ break if (@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[2]/span[2]").text == "\"SVNLICDLD02\"" rescue false); sleep 1 }
(@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[2]/span[2]").text).should == "\"SVNLICDLD02\""
!60.times{ break if (@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[3]/span[2]").text == "0" rescue false); sleep 1 }
(@driver.find_element(:xpath, "html/body/div[1]/ul/li[1]/ul/li[15]/ul/li[#{index}]/ul/li[3]/span[2]").text).should == "0"
Status Code Status Message Symbol
1xx Informational
100 Continue :continue
101 Switching Protocols :switching_protocols
102 Processing :processing
2xx Success
200 OK :ok
201 Created :created
202 Accepted :accepted
require 'active_record'
connection_info = YAML.load_file("config/database.yml")["test"]
ActiveRecord::Base.establish_connection(connection_info)
RSpec.configure do |config|
config.around do |example|
ActiveRecord::Base.transaction do
example.run
raise ActiveRecord::Rollback
require 'minitest/autorun'
class TestDescribe < Minitest::Test
def test_that_it_can_pass
whatever "that it describes" do
another_block "lol" do
end
end
end