This is a typical controller spec.
let(:contact_service) { double('FacebookContactService', import_in_background_for_stale_member: nil) }
it 'does something' do
controller.contact_service = contact_service
post :create
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/> | |
<title></title> | |
<script type="text/javascript" src="https://js.thebestday.com/v1"></script> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
</head> | |
<body> | |
<h1>2 Stews and a Cockatoo</h1> |
'use strict'; | |
describe('route', function() { | |
beforeEach(function() { | |
module('route'); | |
}); | |
describe('#projectPath', function() { | |
it('replaces :org', inject(function(route) { | |
var options = {org: 'tatey'}, |
This is a typical controller spec.
let(:contact_service) { double('FacebookContactService', import_in_background_for_stale_member: nil) }
it 'does something' do
controller.contact_service = contact_service
post :create
module Designate | |
def designate method_name, arity: 0 | |
define_singleton_method method_name do |*args| | |
new(*args).send method_name | |
end | |
end | |
end | |
class HipChatService | |
extend Designate |
<script type="text/javascript"> | |
(function() { | |
'use strict'; | |
var ExceptionNotifier = function() { | |
this.service = window.Bugsnag; | |
}; | |
ExceptionNotifier.prototype.notify = function() { | |
if (this.service) { |
#!/usr/bin/env ruby | |
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __FILE__) | |
require 'bundler/setup' | |
require 'sequel' | |
if ARGV.size != 2 | |
puts "usage: #{__FILE__} <DATA_PATH> <DB_PATH>" | |
puts " #{__FILE__} ~/Desktop/sites.txt ~/Desktop/database.sqlite" | |
abort |
// Create a function on the controller that computes propA | |
// and popC. | |
function ModelCtrl($scope) { | |
$scope.models = [{propA: 'A', probB: 'B'}]; | |
$scope.propC = function(model) { | |
return model.propA + model.propB; | |
} | |
} |
class ViewController | |
include TableSection | |
def numberOfSectionsInTableView(tableView) | |
2 | |
end | |
def numberOfRowsInSection0(tableView) | |
@data.count | |
end |
# RecursiveClosedStruct is similar to OpenStruct, except: | |
# | |
# * Immutable. Cannot be changed after instantiation. | |
# * Raises NoMethodError on undefined methods instead of returning nil. | |
# * Recursively coerces descendants into a RecursiveClosedStruct. | |
# | |
# NoMethodError example: | |
# struct = RecursiveClosedStruct.new(key1: "value") | |
# struct.key1 # => "value" | |
# struct.key2 # => NoMethodError |
#!/usr/bin/env ruby | |
require_relative '../config/boot' | |
require_relative '../config/environment' | |
require 'delayed/command' | |
Delayed::Command.new(ARGV).daemonize |