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.
source :gemcutter | |
gem 'rails', '~> 2.3.5', :require => nil |
require 'rack/utils' | |
module Rack | |
# | |
# EnforceSSL is a Rack middleware app that enforces that users visit | |
# specific paths via HTTPS. If a sensitive path is requested over | |
# plain-text HTTP, a 307 Redirect will be issued leading to the HTTPS | |
# version of the Requested URI. | |
# | |
# MIT License - Hal Brodigan (postmodern.mod3 at gmail.com) |
SOAP request: | |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://v1_0.validation.ws.chief.blau.de/"> | |
<soapenv:Header/> | |
<soapenv:Body> | |
<v1:validateName> | |
<validationRequest> | |
<names> | |
<firstName>David</firstName> | |
<lastName>Hasselhoff</lastName> |
This example shows how to setup an environment running Rails 3 beta 3 under 1.9.2-head with a 'rails3' gem set. | |
∴ rvm update --head | |
# ((Open a new shell)) or do 'rvm reload' | |
# If you do not already have the ruby interpreter installed, install it: | |
∴ rvm install 1.9.2-head | |
# Switch to 1.9.2-head and gemset rails3, create if it doesn't exist. | |
∴ rvm --create use 1.9.2-head@rails3 |
This example shows how to setup an environment running Rails 3 beta 3 under 1.9.2-head with a 'rails3' gem set. | |
∴ rvm update --head | |
# ((Open a new shell)) or do 'rvm reload' | |
# If you do not already have the ruby interpreter installed, install it: | |
∴ rvm install 1.9.2-head | |
# Switch to 1.9.2-head and gemset rails3, create if it doesn't exist. | |
∴ rvm --create use 1.9.2-head@rails3 |
#!/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: | |
# |
require "active_model" | |
# = EmailValidator | |
# | |
# Validates whether the value of the specified attribute is a valid email address. | |
# Borrowed from http://github.com/dancroak/validates_email_format_of and ported to Rails 3. | |
# | |
# ==== Example | |
# | |
# class User |
require "savon" | |
client = Savon::Client.new "http://example.com" | |
client.login! { |soap| soap.body = { :username => 'un', :password => 'pw' } } | |
# Expected debug output: | |
# | |
# SOAP request: http://example.com | |
# SOAPAction: login, Content-Type: text/xml;charset=UTF-8 | |
# <?xml version="1.0" encoding="UTF-8"?> |
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.