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 ObjectCreationMethods | |
def new_ci_source(overrides = {}) | |
defaults = {name: "testrepo", owner: "blairtest", active:false} | |
CiSource.new(defaults.merge(overrides)) | |
end | |
def create_ci_source(overrides = {}) | |
ci_source = new_ci_source(overrides) |
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 'minitest/autorun' | |
require 'minitest/pride' | |
require_relative 'beer_song' | |
class BeerSongTest < MiniTest::Unit::TestCase | |
def beer_song | |
@beer_song = ::BeerSong.new | |
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 BeerSong | |
def verses(beginning, ending = 0) | |
song = "" | |
beginning.downto(ending).each do |n| | |
song << verse(n) + "\n" | |
end | |
song | |
end | |
def verse(n) |
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 Centaur | |
attr_reader :name, :breed | |
def initialize(name, breed) | |
@name = name | |
@breed = breed | |
@standing = true | |
@actions = 0 | |
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 Phoenix | |
attr_reader :name, :age, :lives | |
def initialize(name) | |
@name = name | |
@age = 0 | |
@alive = true | |
@lives = 1 | |
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
exports.makeMeal = function (meal) { | |
return "Preparing " + meal | |
} | |
var serveDrink = function (drink) { | |
return "Serving " + drink | |
} |
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
# Original Router | |
Rails.application.routes.draw do | |
resources :articles | |
resources :comments | |
resource :account, only: [:show] do | |
get :work | |
end | |
get '/login' => 'sessions#new' |
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
namespace :deploy do | |
desc "Deploys app to Github & production." | |
task all: :environment do | |
if system("rake test:all") == false | |
puts "The tests fail." | |
break | |
end | |
puts "The tests passed." |
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 ApplicationHelper | |
def cache_key_for(model) | |
prefix = model.to_s.downcase.pluralize | |
count = model.count | |
max_updated_at = model.maximum(:updated_at).try(:utc).try(:to_s, :number) | |
"#{prefix}/all-#{count}-#{max_updated_at}" | |
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
development: | |
github_key: 710899dd3710a6a9814e | |
github_secret: 102dc5253ae360eaae533e7dc5ceb46929dcbe4b |