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_tree ./vendor | |
//= require_directory . |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Shmup Game</title> | |
<meta charset="utf-8"> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width"> | |
<link rel="stylesheet" href="/assets/application.css"> |
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
source :rubygems | |
gem 'sinatra' | |
gem 'sprockets' | |
gem 'coffee-script' |
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 'bundler/setup' | |
Bundler.require | |
class Application < Sinatra::Base | |
get '/assets/:file' do | |
env['PATH_INFO'].gsub!("/assets","") | |
asset_handler.call(env) | |
end | |
get '/' 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
require "devise" | |
module Devise | |
module Mailers | |
module Helpers | |
include Resque::Mailer | |
alias_method :old_initialize_from_record, :initialize_from_record | |
protected |
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
module Tree | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def leaves | |
where("children = ?::integer[]", [].pg) | |
end | |
def roots | |
where("ancestry = ?::integer[]", [].pg) |
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
module Tree | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def leaves | |
where("children = ?::integer[]", [].pg) | |
end | |
def roots | |
where("ancestry = ?::integer[]", [].pg) |
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
test_tree=# insert into tags (name, ancestry) values ('child', '{1}') returning id; | |
id | |
---- | |
4 | |
(1 row) | |
INSERT 0 1 |
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 "minitest/mock" | |
=> true | |
>> mock = MiniTest::Mock.new | |
=> #<MiniTest::Mock:0x007fc48ca57d70 @expected_calls={}, @actual_calls={}> | |
>> mock.respond_to? :abc | |
=> false | |
>> mock.expect(:abc, "123") | |
=> #<MiniTest::Mock:0x007fc48ca57d70 @expected_calls={:abc=>{:retval=>"123", :args=>[]}}, @actual_calls={}> | |
>> mock.respond_to? :abc | |
=> true |
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
ENV['RAILS_ENV'] = "test" | |
unless defined?(Bundler) | |
require 'bundler/setup' | |
end | |
require 'minitest/autorun' | |
require 'factory_girl' | |
MiniTest::Unit::TestCase.send(:include, FactoryGirl::Syntax::Methods) |