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 (auctioneer_tests). | |
-include_lib("eunit/include/eunit.hrl"). | |
check_auctioneer_announces_item_to_room_test() -> | |
AuctionRoom = nspy:new(), | |
Auctioneer = auctioneer:start("Penguin", 20, AuctionRoom), | |
timer:sleep(1000), | |
Auctioneer ! stop, | |
ExpectedMessage = {starting_auction, {lot, 1, 20, "Penguin"}, "Next up lot 1, a fine Penguin, starting at 20\n"}, | |
nspy:assert_message_received(AuctionRoom, ExpectedMessage). |
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
#as seen in https://github.com/mooktakim/heroku_deployment | |
class AppTemplatesController < ApplicationController | |
def app | |
render :inline => "SUCCESS", :layout => 'master' | |
end | |
def cms | |
render :inline => "SUCCESS", :layout => 'cms_admin' | |
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
describe "logger" do | |
before(:each) do | |
@old_flush = controller.logger.auto_flushing | |
@old_level = controller.logger.level | |
controller.logger.auto_flushing=0 | |
controller.logger.level = ActiveSupport::BufferedLogger::Severity::ERROR | |
end | |
it "logs an error" do | |
#would prefer to test this with a test-spy / mock expectations but there's a lot of level-0 logging noise to ignore, so went with reading the log itself |
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
#assumes use of capybara for request specs | |
require 'spec_helper' | |
describe "StaticPages" do | |
class FlashController < ApplicationController | |
def set_flash | |
flash[:notice] = params[:message] | |
flash[:error] = params[:message] | |
flash[:alert] = params[:message] |
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
Then /^a static page cache file for #{capture_model} should not exist$/ do |pickle_ref| | |
page = model!(pickle_ref) | |
page_cache_exist?(page).should be_false | |
end | |
Then /^a static page cache file for #{capture_model} should exist$/ do |pickle_ref| | |
page = model!(pickle_ref) | |
page_cache_exist?(page).should be_true | |
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
# run with Piece.xor_files 'output_filepath', ['infilepath1','infilepath2'] | |
require 'inline' | |
Class Piece | |
inline do |builder| | |
builder.include '<stdlib.h>' | |
builder.include '<stdio.h>' | |
builder.c_singleton <<-C_CODE | |
/* | |
rb_input_paths_array should be a ruby array of strings, |
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
Old tired programmers() -> | |
obviously trusted prolog, | |
others tried perl. | |
Oft they pondered() -> | |
of teams problems, | |
of telcos pains. | |
Onward they plodded() -> | |
obscure to programmers, |
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
all: send-more-money donald | |
# use git clean -f for make clean, but confirm action | |
define gitCLEAN | |
puts 'ARE YOU SURE (git clean -f) ? y/n'; \ | |
puts %x(git clean -n); \ | |
exec('git clean -f') if gets.chomp =~ /^y/i | |
endef | |
clean: |
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
# -*- encoding : utf-8 -*- | |
class Sitemap | |
def self.static_view_templates | |
require 'fileutils' | |
template_paths = [] | |
FileUtils.cd Rails.root.join 'app', 'views', 'static_pages' do | |
erb_html_files = File.join "**", "*.html.erb" | |
template_paths = Dir.glob(erb_html_files) | |
end | |
remove_html_erb!(template_paths) |
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
# last entry: | |
#static page routes | |
get '/home' => redirect('/') | |
root :to => 'static_pages#home' | |
get '*page', :to => 'static_pages#show', :constraints => {:page => %r{[\w\-\/]+}} |