Hi,
I would love to hear your opinion on the idea of “combining RDoc and RSpec to create testable documentation”. Let me explain:
Given you have several RDoc files like this one:
= Examples Some example code snippets.
| # If you'd like this packaged up as a gem, send me a note. You can get | |
| # in touch with me at http://www.techiferous.com/about | |
| require 'nokogiri' | |
| require 'ispell' | |
| module Rack | |
| class SpellCheck | |
| def initialize(app, options = {}) |
| module Rack | |
| # A rack middleware for validating HTML via w3c validator | |
| class Validate | |
| def initialize( app ) | |
| @app = app | |
| end | |
| def call( env ) |
Hi,
I would love to hear your opinion on the idea of “combining RDoc and RSpec to create testable documentation”. Let me explain:
Given you have several RDoc files like this one:
= Examples Some example code snippets.
| # List of environments and their heroku git remotes | |
| ENVIRONMENTS = { | |
| :staging => 'myapp-staging', | |
| :production => 'myapp-production' | |
| } | |
| namespace :deploy do | |
| ENVIRONMENTS.keys.each do |env| | |
| desc "Deploy to #{env}" | |
| task env do |
| # unicorn_rails -c /srv/myapp/current/config/unicorn.rb -E production -D | |
| rails_env = ENV['RAILS_ENV'] || 'production' | |
| working_directory (rails_env == 'production' ? "/srv/myapp/current" : `pwd`.gsub("\n", "")) | |
| worker_processes (rails_env == 'production' ? 10 : 4) | |
| preload_app true | |
| timeout 30 | |
| if rails_env == 'production' |
| RAKEFILE = <<-RAKEFILE | |
| require File.dirname(__FILE__) + '/config/boot.rb' | |
| require 'thor' | |
| require 'padrino-core/cli/rake' | |
| PadrinoTasks.init | |
| RAKEFILE | |
| PV = Padrino.version | |
| GEMFILE = <<-GEMFILE |
| #!/usr/bin/env ruby | |
| require 'uri' | |
| require 'nokogiri' | |
| require 'mechanize' | |
| require 'logger' | |
| trap('INT') { @crawler.report; exit } | |
| class Crawler |
| require 'spec_helper' | |
| describe Users::OauthCallbacksController, "handle facebook authentication callback" do | |
| describe "#annonymous user" do | |
| context "when facebook email doesn't exist in the system" do | |
| before(:each) do | |
| stub_env_for_omniauth | |
| get :facebook |
| # MySQL. Versions 4.1 and 5.0 are recommended. | |
| # | |
| # Install the MySQL driver: | |
| # gem install mysql2 | |
| # | |
| # And be sure to use new-style password hashing: | |
| # http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
| development: | |
| adapter: mysql2 | |
| encoding: utf8 |
| # autoload concerns | |
| module YourApp | |
| class Application < Rails::Application | |
| config.autoload_paths += %W( | |
| #{config.root}/app/controllers/concerns | |
| #{config.root}/app/models/concerns | |
| ) | |
| end | |
| end |