This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rails_helper" | |
describe TestsController, type: :controller do | |
render_views | |
let(:tests){FactoryGirl.create_list :test, 3} | |
let(:test){FactoryGirl.create :test} | |
describe "GET #index" do | |
before {get :index} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Install Docker 1.13.1 | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
linux-image-extra-$(uname -r) \ | |
linux-image-extra-virtual | |
curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add - | |
apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D | |
sudo apt-get install -y software-properties-common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruby 2.5.1 | |
# ----- Result ------ | |
# Normal: 0.0035529999986465555s | |
# Exception: 0.08799100000032922s | |
# Exception/Normal: 24.765268796467108 | |
# Catch&Throw: 0.027447000000393018s | |
# Catch&Throw/Normal: 7.725021111975346 | |
require 'benchmark' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'faraday' | |
class BadExampleClient | |
DEFAULT_URL = 'https://example.com'.freeze | |
def get(url=DEFAULT_URL) | |
Faraday.get url | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'faraday' | |
class GoodExampleClient | |
DEFAULT_URL = 'https://example.com'.freeze | |
def get(url=DEFAULT_URL) | |
r = Faraday.get url | |
Response.new(r.body, r.status) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'uri' | |
class GoodExampleXClient | |
DEFAULT_URL = 'https://example.com'.freeze | |
def get(url=DEFAULT_URL) | |
r = Net::HTTP.get_response(URI.parse(url)) | |
Response.new(r.body, r.code) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM LOG | |
WHERE time >= '2020-03-06T03:14:00Z' AND time < '2020-03-06T03:35:00Z' ORDER BY time; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rspec | |
on: pull_request | |
jobs: | |
rspec: | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: mysql:5.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'capybara/rspec' | |
require 'selenium-webdriver' | |
Capybara.server_host = Socket.ip_address_list.detect{|addr| addr.ipv4_private?}.ip_address | |
Capybara.register_driver :selenium_chrome_headless do |app| | |
opts = { desired_capabilities: :chrome, browser: :remote, url: ENV['SELENIUM_URL'] } | |
Capybara::Selenium::Driver.new(app, opts) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case like.likable | |
when Post | |
PostExcutor.call(like) | |
when Comment | |
CommentExcutor.call(like) | |
end |
OlderNewer