RSpec

SC

http:redmine.fireho.com/attachments/download/40/nofxx_-_rspec.mov ===== Outros SC (inglês) ===== Story Driven Development http:goruco2008.confreaks.com/01_helmkamp.html

http:www.railsenvy.com/2007/10/4/how-i-learned-to-love-testing-presentation ===== links ===== http:blog.davidchelimsky.net/articles/2007/05/14/an-introduction-to-rspec-part-i

http:rspec.info/ http:rspec.info/rdoc/

http:eigenclass.org/hiki.rb?rcov Rspec rails: http:snippets.dzone.com/posts/show/4721

Stories:

http:tomtenthij.co.uk/2008/1/25/rspec-plain-text-story-runner-on-a-fresh-rails-app http:evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner

autotest

http:www.nomedojogo.com/2008/06/17/autotest-notification-doom-edition/ http:szeryf.wordpress.com/2007/07/30/way-beyond-cool-autotest-growl-doomguy/

Hash additions

# ##
# rSpec Hash additions.
#
# From 
#   * http://wincent.com/knowledge-base/Fixtures_considered_harmful%3F
#   * Neil Rahilly
class Hash
  ##
  # Filter keys out of a Hash.
  #
  #   { :a => 1, :b => 2, :c => 3 }.except(:a)
  #   => { :b => 2, :c => 3 }
  def except(*keys)
    self.reject { |k,v| keys.include?(k || k.to_sym) }
  end
  ##
  # Override some keys.
  #
  #   { :a => 1, :b => 2, :c => 3 }.with(:a => 4)
  #   => { :a => 4, :b => 2, :c => 3 }
  def with(overrides = {})
    self.merge overrides
  end
  ##
  # Returns a Hash with only the pairs identified by +keys+.
  #
  #   { :a => 1, :b => 2, :c => 3 }.only(:a)
  #   => { :a => 1 }
  def only(*keys)
    self.reject { |k,v| !keys.include?(k || k.to_sym) }
  end
end

Object Daddy

Bye fixtures!

http:github.com/flogic/object_daddy/tree/master ../spec/exemplars/objeto_exemplar.rb <code ruby> class Objeto < ActiveRecord::Base generator_for :nome, “Manoel foi pro ceu” generator_for :nunico, :method ⇒ :next self.next @last ||= 1 @last += 1 end end </code> Using: <code> Objeto.generate ⇒ Objeto.create(:nome ⇒ “Manoel….”) Objeto.generate! ⇒ Objeto.create!….. Objeto.spawn ⇒ Objeto.new… </code> ===== Growl ===== THIS IS OLD.. USE NOTIFICATION GEM fail.png pass.png <code ruby> #require 'autotest/growl' require 'autotest/html_report' # require 'autotest/kdenotify' require 'autotest/menu' #require 'autotest/pretty' require 'autotest/redgreen' # require 'autotest/snarl' require 'autotest/timestamp' module Autotest::Growl def self.growl pass, title, msg, img, pri=0, sticky=”” system “growlnotify -n #{pass} –image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}” end Autotest.add_hook :initialize do |at| growl “autotest”, “Rodando..”, “Started autotest”, end Autotest.add_hook :ran_command do |at| output = at.results.last.gsub!(/(\e\[3\dm)|(\e\[0m)|(\n)/, ) unless at.results.last.nil? if output =~ /[1-9]\sfailures?/ growl “epic”, “BURRO!”, ”#{output}”, ”.autotest_images/fail.png”, 2, ”-s” else growl “autotest”, “GO GO GO”, ”#{output}”, ”.autotest_images/pass.png”,2 end end end </code> ==== Links ==== http:ph7spot.com/articles/getting_started_with_autotest

 
Back to top
rspec.txt · Last modified: 2009/07/09 20:05 (external edit)
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0