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
module TurbolinksHelpers | |
def assert_turbolinks_redirected_to(options = {}, message = nil) | |
assert_response(:success, message) | |
assert_equal("text/javascript", @response.content_type) | |
redirect_is = @response.body[/Turbolinks.visit\("([^"]+)/, 1] | |
redirect_expected = normalize_argument_to_redirection(options) | |
assert_operator redirect_expected, :===, redirect_is, message | |
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
class AddTimestampsEverywhere < ActiveRecord::Migration[5.1] | |
def change | |
now = Time.current | |
%i[ | |
candidates | |
evaluations | |
interviewers | |
questions | |
responses |
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 "abstract_unit" | |
require "active_support/time" | |
require "time_zone_test_helpers" | |
class DateAndTimeCompatibilityTest < ActiveSupport::TestCase | |
include TimeZoneTestHelpers | |
def setup | |
@utc_time = Time.utc(2016, 4, 23, 14, 11, 12) | |
@date_time = DateTime.new(2016, 4, 23, 14, 11, 12, 0) |
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 'date' | |
require 'time' | |
ENV['TZ'] = 'America/New_York' | |
time = Time.new(2017, 1, 1, 0, 0, 0, "+02:00").freeze | |
date = Date.new(2017, 1, 1).freeze | |
datetime = DateTime.new(2017, 1, 1, 0, 0, 0, Rational(2, 24)).freeze | |
# Time | |
puts "Time#to_time | #{RUBY_VERSION} " |
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 'csv' | |
require 'faraday' | |
require 'json' | |
require 'uri' | |
url = URI.parse('https://petition.parliament.uk/archived/petitions.json') | |
response = Faraday.get(url) | |
unless response.success? |
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
class Postgis21 < Formula | |
desc "Adds support for geographic objects to PostgreSQL" | |
homepage "http://postgis.net" | |
url "http://pkgs.fedoraproject.org/repo/pkgs/postgis/postgis-2.1.8.tar.gz/c33923e37424978a1306ce461c1d14ed/postgis-2.1.8.tar.gz" | |
sha256 "7c2380b895fe7bda34c2e70deab3fcf4c12b13ab40d7501cdaa6fa36f1a6c662" | |
revision 1 | |
def pour_bottle? | |
# Postgres extensions must live in the Postgres prefix, which precludes | |
# bottling: https://github.com/Homebrew/homebrew/issues/10247 |
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 'formula' | |
class Sphinx < Formula | |
url 'http://sphinxsearch.com/files/archive/sphinx-0.9.9.tar.gz' | |
homepage 'http://www.sphinxsearch.com' | |
sha256 'bf8f55ffc095ff6b628f0cbc7eb54761811140140679a1c869cc1b17c42803e4' | |
depends_on 'homebrew/dupes/apple-gcc42' | |
resource 'stemmer' do |
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
# Activate the gem you are reporting the issue against. | |
gem 'activerecord', '4.2.4' | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
# Ensure backward compatibility with Minitest 4 | |
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) | |
# This connection will do for database-independent bug reports. |
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 'formula' | |
class Sphinx20 < Formula | |
homepage 'http://www.sphinxsearch.com' | |
url 'http://sphinxsearch.com/files/sphinx-2.0.9-release.tar.gz' | |
sha256 'c4fb5d7951bc0831e46f102d17b5f32bbde11434ce3b00b20531dfe9e646869d' | |
head 'http://sphinxsearch.googlecode.com/svn/trunk/' | |
devel do |
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
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' |