This file contains hidden or 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
--- | |
language: ruby | |
rvm: | |
- 2.0.0 | |
bundler_args: --without development --path=~/.bundle | |
env: | |
global: | |
- BUNDLE_ARCHIVE="app-bundle-archive" | |
- RAILS_ENV=test | |
- secure: "A_VERY_LONG_SERIES_OF_CHARACTERS_HERE" |
This file contains hidden or 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
RSpec.configure do |config| | |
# ... | |
config.after(:all) do | |
FileUtils.rm_rf(Dir["#{Rails.root}/tmp/test/carrierwave"]) | |
end | |
end | |
CarrierWave.configure do |config| | |
config.root = "#{Rails.root}/tmp/test/carrierwave" |
This file contains hidden or 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_admin/config/fields/base' | |
module RailsAdmin | |
module Config | |
module Fields | |
module Types | |
class Datetime < RailsAdmin::Config::Fields::Base | |
def value | |
value_in_default_time_zone = bindings[:object].send(name) |
This file contains hidden or 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/bash | |
i=0 | |
files=() | |
# sort spec files by number of examples for better balancing | |
for file in $(find ./spec -name "*_spec.rb" -print0 | xargs -0 grep -e "^ *(it|specify)" -c | sort -t: -k2,2rn | awk -F":" '{ print $1 }') | |
do | |
if [ $(($i % $CIRCLE_NODE_TOTAL)) -eq $CIRCLE_NODE_INDEX ] | |
then | |
files+=" $file" |
This file contains hidden or 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 | |
CONTAINERS=`docker ps -q` | |
echo $CONTAINERS | |
if [ "$CONTAINERS" == "" ]; | |
then | |
echo no running containers | |
else | |
echo containers exist, stopping them |
This file contains hidden or 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
while rspec spec/models/user_spec.rb; do :; done |
This file contains hidden or 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 GildedRose | |
def initialize(items) | |
@items = items | |
end | |
def update_quality() | |
@items.each do |item| | |
if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert" | |
if item.quality > 0 | |
if item.name != "Sulfuras, Hand of Ragnaros" |
This file contains hidden or 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
it 'increases to 50 when sell_in above 10 and quality is 49' do | |
item = Item.new('Backstage passes to a TAFKAL80ETC concert', sell_in=15, quality=49) | |
items = [item] | |
gilded_rose = described_class.new(items) | |
gilded_rose.update_quality | |
expect(item.quality).to eq 50 | |
end | |
it 'increases to 50 instead of 51 when sell_in at least 5 and quality is 49' do |
This file contains hidden or 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
# It requries installed nodemon | |
# $ npm install -g nodemon | |
# | |
# Add this in your ~/.bash_profile | |
# | |
# How to use it? | |
# | |
# Run spec for user_spec.rb when file changed. | |
# $ wr spec/models/user_spec.rb | |
# |
OlderNewer