A proof of concept of having Sinatra like routes inside your controllers.
Since the router is gone, feel free to remove config/routes.rb.
Then add the file below to lib/action_controller/inline_routes.rb
inside your app.
| .list-container { | |
| border-radius: 5px; | |
| border: 1px solid #C5C5C5; | |
| box-shadow: inset 0 1px 0 #FFF; | |
| } | |
| ol { | |
| border: 1px solid transparent; | |
| } |
| input { | |
| height: 34px; | |
| width: 100%; | |
| border-radius: 3px; | |
| border: 1px solid transparent; | |
| border-top: none; | |
| border-bottom: 1px solid #DDD; | |
| box-shadow: inset 0 1px 2px rgba(0,0,0,.39), 0 -1px 1px #FFF, 0 1px 0 #FFF; | |
| } |
| # A config.ru useful for serving static sites from the "Bamboo" heroku stack. | |
| # | |
| # Interface: | |
| # | |
| # Url Path | Action | |
| # -------- | ------------------------------------------------------------- | |
| # / | contents of: index.html OR | |
| # | contents of: 404.html OR | |
| # | default 404 message | |
| # | |
| class ActionDispatch::Routing::Mapper | |
| def draw(routes_name) | |
| instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) | |
| end | |
| end | |
| BCX::Application.routes.draw do | |
| draw :api | |
| draw :account | |
| draw :session |
I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").
Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):
# minitest/spec.rb
module MiniTest::ExpectationsJust install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
| #! /usr/bin/env ruby -r ftools | |
| # "vname" by Henrik Nyh <http://henrik.nyh.se> on 2010-05-28 under the MIT license. | |
| # | |
| # Usage: | |
| # | |
| # vname PATTERN | |
| # | |
| # Prompts to rename files in the working directory matching the PATTERN into this pattern: | |
| # | |
| # X-Files - S01E03 - Pilot.avi |
| #!/usr/bin/env ruby | |
| # Usage: gemspec [-s] GEMNAME | |
| # | |
| # Prints a basic gemspec for GEMNAME based on your git-config info. | |
| # If -s is passed, saves it as a GEMNAME.gemspec in the current | |
| # directory. Otherwise prints to standard output. | |
| # | |
| # Once you check this gemspec into your project, releasing a new gem | |
| # is dead simple: | |
| # |
| #!/bin/sh -x | |
| # Exit if any error is encountered: | |
| set -o errexit | |
| # git name-rev is fail | |
| CURRENT=`git branch | grep '\*' | awk '{print $2}'` | |
| git checkout master | |
| git merge ${CURRENT} | |
| git push origin master | |
| git checkout ${CURRENT} |