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
var tessel = require('tessel'); | |
var rfidlib = require('rfid-pn532'); | |
var http = require('http'); | |
var querystring = require('querystring'); | |
var rfid = rfidlib.use(tessel.port['A']); | |
rfid.on('ready', function (version) { |
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 "test_helper" | |
describe TornamentsController do | |
let(:tornament) { tornaments :one } | |
it "gets index" do | |
get :index | |
assert_response :success | |
assert_not_nil assigns(:tornaments) |
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 "test_helper" | |
describe TornamentsController do | |
let(:tornament) { tornaments :one } | |
it "gets index" do | |
get :index | |
assert_response :success | |
assert_not_nil assigns(:tornaments) |
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 TornamentsController < ApplicationController | |
before_action :authenticate_user!, only: [:new, :edit, :update, :destroy] | |
before_action :set_tornament, only: [:show, :edit, :update, :destroy] | |
respond_to :html | |
def index | |
@tornaments = Tornament.all | |
respond_with(@tornaments) | |
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 Reaction | |
def initialize(yield_to) | |
self.yield_to = yield_to | |
end | |
def method_missing(method_name, *) | |
if yieldable?(method_name) | |
yield if block_given? | |
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
# From http://blog.boochtek.com/2015/02/23/hexagonal-rails-controllers | |
class OrderController < ApplicationController | |
def index | |
interactor.on(:display) { |orders| render orders } | |
interactor.list | |
end | |
def show | |
interactor.on(:display) { |order| render order } |
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 File.dirname(__FILE__) + '/../test_helper' | |
class LoggedInControllerExtensionTest < ActiveSupport::TestCase | |
def setup | |
self.expects(:before_filter).with(:foo) | |
self.include LoggedInControllerExtension | |
end | |
def test |
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 'cgi' | |
module LoggedInControllerExtension | |
def self.included(base) | |
base.extend Setup | |
base.setup_logged_in | |
end | |
module Setup | |
def setup_logged_in |
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 'test_helper' | |
class PeopleIntegrationTest < ActionController::IntegrationTest | |
use_transactional_fixtures = false | |
context "context no records" do | |
setup do | |
Person.create!(:name => 'Mike Gaffney') | |
visit(people_path) | |
click_link("Create 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
Webrat.configure do |config| | |
config.mode = :rails | |
end |