Skip to content

Instantly share code, notes, and snippets.

View gonzalo-bulnes's full-sized avatar

Gonzalo Bulnes Guilpain gonzalo-bulnes

View GitHub Profile
@gonzalo-bulnes
gonzalo-bulnes / Rakefile
Last active August 29, 2015 14:15
(Update: I've packaged this gist into a gem to make its use easier, see: https://github.com/gonzalo-bulnes/dredd-rack.) Add validation against an API blueprint to a Ruby test suite (by defining a Rake task).
# Rakefile
# Add Rainbow to the app dependencies. That's optional, but the result is worth it.
require 'rainbow'
# ...
# Validate an API against its API blueprint
#
# The API blueprints are expected to be stored in `doc/` and
@gonzalo-bulnes
gonzalo-bulnes / Rakefile
Created February 23, 2015 14:32
Split the test suite using RSpec tags.
# Rakefile
begin
require 'rspec/core/rake_task'
desc 'Provide private interfaces documentation'
RSpec::Core::RakeTask.new(:spec)
namespace :spec do
desc 'Provide public interfaces documentation'
@gonzalo-bulnes
gonzalo-bulnes / Rakefile
Created April 5, 2015 15:06
Add validation of an app.json file to a Ruby test suite (by defining a Rake task).
# Rakefile
namespace :app_json do
desc 'Validate the app.json manifest'
task :validate do
require 'rainbow'
# check if the app.json validator is available
`which app.json`
if $?.exitstatus != 0
@gonzalo-bulnes
gonzalo-bulnes / Rakefile
Created June 2, 2015 18:01
Add documentation improvement suggestions to a Ruby test suite (by defining a Rake task with Inch).
# Rakefile
begin
require 'inch/rake'
Inch::Rake::Suggest.new(:inch) do |suggest|
suggest.args << "--private"
suggest.args << "--pedantic"
end
rescue LoadError
@gonzalo-bulnes
gonzalo-bulnes / docker-compose.yml
Last active October 1, 2015 20:28
Setup a development environment for Bottled Water using Docker Compose.
zookeeper:
image: confluent/zookeeper
ports:
- 2181
kafka:
image: confluent/kafka
ports:
- "9092:9092"
links:
@gonzalo-bulnes
gonzalo-bulnes / README.md
Last active October 26, 2015 16:19
Example of modularization with Python packages.
# Run the hello game:
python hello_game.py

# Run the hello and bye game:
python hello_and_bye_game.py
# acid-template.rb
git :init
gitignore = run("curl https://gist.github.com/raw/3875160/5d2745ee9bcae0bb4addf4bc701d3fa9a48ce187/.gitignore")
file ".gitignore", gitignore
if yes?("Do you use RVM? (yes|no")
if yes?("Do you want to create a .rvmrc file for the project? (yes|no)")
# RVM
current_ruby = %x{rvm list}.match(/^=>\s+(.*)\s\[/)[1].strip
desired_ruby = ask("Which RVM Ruby would you like to use? [#{current_ruby}]")
es:
errors:
messages:
not_found: "no encontrado"
already_confirmed: "ya ha sido confirmado"
not_locked: "no está bloqueado"
devise:
sessions:
link: 'Ingresar'
@gonzalo-bulnes
gonzalo-bulnes / work_place_spec.rb
Created April 10, 2013 23:28
Using lambda functions to test exception raising with RSpec.
require 'spec_helper'
describe WorkPlace do
# This is the simplest (best) way to test a dependent: :destroy option
it "has one address and ensures it's destroyed when destroyed itself" do
should have_one(:address).dependent(:destroy)
end
# ... however the use this example does of lambda {} to encapsulate the code
#Load in rails via:
# config/initializers/core_extensions.rb
#Forcibly require our core extensions after rails has loaded
Dir.glob(Rails.root.join('lib', 'core_ext', '*.rb')).each { |extension| require extension }