Wrap text
Report abuse
YAML to RSpec - Command in TextMate
|
|
Save: Nothing
Command(s):
RUBYLIB="$TM_BUNDLE_SUPPORT/lib:$RUBYLIB"
"${TM_RUBY:=ruby}" -- "${TM_BUNDLE_SUPPORT}/bin/yaml_to_rspec.rb"
Input: Entire Document
Output: Create New Document
Activation: Key Equivalent (whatever you want)
Scope Selector: source.yaml
|
The yaml_to_rspec.rb file in the Rails.tmbundle
|
|
#!/usr/bin/env ruby
require "yaml"
buffer = []
STDIN.each_line { |l| buffer << l }
contexts = YAML::load(buffer.join("\n"))
contexts.each do |context,specifications|
puts ""
puts "context \"#{context}\" do"
puts ""
specifications.each do |specification|
puts " specify \"#{specification}\" do"
puts " violated \"no assertions performed\""
puts " end"
puts ""
end
puts "end"
end
|