Removed ThoughtBot module.

The ThoughtBot module had been added (by me) as a paranoid namespacing measure,
just in case any other code wanted to use a class or module named Shoulda.
Silly.
This commit is contained in:
Tammer Saleh 2008-06-22 11:40:10 -04:00
parent 5e4222694b
commit fc938bb185
11 changed files with 1660 additions and 1675 deletions

View File

@ -10,7 +10,7 @@ Assertions:: Many common rails testing idioms have been distilled into a set of
= Usage = Usage
=== Context Helpers (ThoughtBot::Shoulda::Context) === Context Helpers (Shoulda::Context)
Stop killing your fingers with all of those underscores... Name your tests with plain sentences! Stop killing your fingers with all of those underscores... Name your tests with plain sentences!
@ -43,7 +43,7 @@ Produces the following test methods:
So readable! So readable!
=== ActiveRecord Tests (ThoughtBot::Shoulda::ActiveRecord) === ActiveRecord Tests (Shoulda::ActiveRecord)
Quick macro tests for your ActiveRecord associations and validations: Quick macro tests for your ActiveRecord associations and validations:
@ -73,7 +73,7 @@ Quick macro tests for your ActiveRecord associations and validations:
Makes TDD so much easier. Makes TDD so much easier.
=== Controller Tests (ThoughtBot::Shoulda::Controller::ClassMethods) === Controller Tests (Shoulda::Controller::ClassMethods)
Macros to test the most common controller patterns... Macros to test the most common controller patterns...
@ -105,7 +105,7 @@ Test entire controllers in a few lines...
should_be_restful generates 40 tests on the fly, for both html and xml requests. should_be_restful generates 40 tests on the fly, for both html and xml requests.
=== Helpful Assertions (ThoughtBot::Shoulda::General) === Helpful Assertions (Shoulda::General)
More to come here, but have fun with what's there. More to come here, but have fun with what's there.

View File

@ -26,10 +26,10 @@ module Test # :nodoc: all
module Unit module Unit
class TestCase class TestCase
include ThoughtBot::Shoulda::General include Shoulda::General
include ThoughtBot::Shoulda::Controller include Shoulda::Controller
extend ThoughtBot::Shoulda::ActiveRecord extend Shoulda::ActiveRecord
end end
end end
end end
@ -37,7 +37,7 @@ end
module ActionController #:nodoc: all module ActionController #:nodoc: all
module Integration module Integration
class Session class Session
include ThoughtBot::Shoulda::General include Shoulda::General
end end
end end
end end

View File

@ -1,4 +1,3 @@
module ThoughtBot # :nodoc:
module Shoulda # :nodoc: module Shoulda # :nodoc:
# = Macro test helpers for your active record models # = Macro test helpers for your active record models
# #
@ -598,7 +597,6 @@ module ThoughtBot # :nodoc:
private private
include ThoughtBot::Shoulda::Private include Shoulda::Private
end
end end
end end

View File

@ -9,7 +9,7 @@ require 'test/unit/ui/console/testrunner'
# every rake task, as though there was another (empty) set of tests. # every rake task, as though there was another (empty) set of tests.
# A fix would be most welcome. # A fix would be most welcome.
# #
module ThoughtBot::Shoulda::Color module Shoulda::Color
COLORS = { :clear => 0, :red => 31, :green => 32, :yellow => 33 } # :nodoc: COLORS = { :clear => 0, :red => 31, :green => 32, :yellow => 33 } # :nodoc:
def self.method_missing(color_name, *args) # :nodoc: def self.method_missing(color_name, *args) # :nodoc:
color(color_name) + args.first + color(:clear) color(color_name) + args.first + color(:clear)
@ -25,7 +25,7 @@ module Test # :nodoc:
alias :old_to_s :to_s alias :old_to_s :to_s
def to_s def to_s
if old_to_s =~ /\d+ tests, \d+ assertions, (\d+) failures, (\d+) errors/ if old_to_s =~ /\d+ tests, \d+ assertions, (\d+) failures, (\d+) errors/
ThoughtBot::Shoulda::Color.send($1.to_i != 0 || $2.to_i != 0 ? :red : :green, $&) Shoulda::Color.send($1.to_i != 0 || $2.to_i != 0 ? :red : :green, $&)
end end
end end
end end
@ -43,16 +43,16 @@ module Test # :nodoc:
class Failure # :nodoc: class Failure # :nodoc:
alias :old_long_display :long_display alias :old_long_display :long_display
def long_display def long_display
# old_long_display.sub('Failure', ThoughtBot::Shoulda::Color.red('Failure')) # old_long_display.sub('Failure', Shoulda::Color.red('Failure'))
ThoughtBot::Shoulda::Color.red(old_long_display) Shoulda::Color.red(old_long_display)
end end
end end
class Error # :nodoc: class Error # :nodoc:
alias :old_long_display :long_display alias :old_long_display :long_display
def long_display def long_display
# old_long_display.sub('Error', ThoughtBot::Shoulda::Color.yellow('Error')) # old_long_display.sub('Error', Shoulda::Color.yellow('Error'))
ThoughtBot::Shoulda::Color.yellow(old_long_display) Shoulda::Color.yellow(old_long_display)
end end
end end
@ -62,9 +62,9 @@ module Test # :nodoc:
def output_single(something, level=NORMAL) def output_single(something, level=NORMAL)
return unless (output?(level)) return unless (output?(level))
something = case something something = case something
when '.' then ThoughtBot::Shoulda::Color.green('.') when '.' then Shoulda::Color.green('.')
when 'F' then ThoughtBot::Shoulda::Color.red("F") when 'F' then Shoulda::Color.red("F")
when 'E' then ThoughtBot::Shoulda::Color.yellow("E") when 'E' then Shoulda::Color.yellow("E")
else something else something
end end
@io.write(something) @io.write(something)

View File

@ -1,12 +1,11 @@
module ThoughtBot # :nodoc:
module Shoulda # :nodoc: module Shoulda # :nodoc:
module Controller module Controller
def self.included(other) # :nodoc: def self.included(other) # :nodoc:
other.class_eval do other.class_eval do
extend ThoughtBot::Shoulda::Controller::ClassMethods extend Shoulda::Controller::ClassMethods
include ThoughtBot::Shoulda::Controller::InstanceMethods include Shoulda::Controller::InstanceMethods
ThoughtBot::Shoulda::Controller::ClassMethods::VALID_FORMATS.each do |format| Shoulda::Controller::ClassMethods::VALID_FORMATS.each do |format|
include "ThoughtBot::Shoulda::Controller::#{format.to_s.upcase}".constantize include "Shoulda::Controller::#{format.to_s.upcase}".constantize
end end
end end
end end
@ -463,5 +462,3 @@ module ThoughtBot # :nodoc:
end end
end end
end end
end

View File

@ -1,10 +1,9 @@
module ThoughtBot # :nodoc:
module Shoulda # :nodoc: module Shoulda # :nodoc:
module Controller # :nodoc: module Controller # :nodoc:
module HTML # :nodoc: all module HTML # :nodoc: all
def self.included(other) def self.included(other)
other.class_eval do other.class_eval do
extend ThoughtBot::Shoulda::Controller::HTML::ClassMethods extend Shoulda::Controller::HTML::ClassMethods
end end
end end
@ -198,4 +197,3 @@ module ThoughtBot # :nodoc:
end end
end end
end end
end

View File

@ -1,10 +1,9 @@
module ThoughtBot # :nodoc:
module Shoulda # :nodoc: module Shoulda # :nodoc:
module Controller # :nodoc: module Controller # :nodoc:
module XML module XML
def self.included(other) #:nodoc: def self.included(other) #:nodoc:
other.class_eval do other.class_eval do
extend ThoughtBot::Shoulda::Controller::XML::ClassMethods extend Shoulda::Controller::XML::ClassMethods
end end
end end
@ -167,4 +166,3 @@ module ThoughtBot # :nodoc:
end end
end end
end end
end

View File

@ -1,6 +1,5 @@
require File.join(File.dirname(__FILE__), 'proc_extensions') require File.join(File.dirname(__FILE__), 'proc_extensions')
module Thoughtbot
module Shoulda module Shoulda
class << self class << self
attr_accessor :current_context attr_accessor :current_context
@ -40,7 +39,7 @@ module Thoughtbot
Shoulda.current_context.should(name, &blk) Shoulda.current_context.should(name, &blk)
else else
context_name = self.name.gsub(/Test/, "") context_name = self.name.gsub(/Test/, "")
context = Thoughtbot::Shoulda::Context.new(context_name, self) do context = Shoulda::Context.new(context_name, self) do
should(name, &blk) should(name, &blk)
end end
context.build context.build
@ -50,7 +49,7 @@ module Thoughtbot
# Just like should, but never runs, and instead prints an 'X' in the Test::Unit output. # Just like should, but never runs, and instead prints an 'X' in the Test::Unit output.
def should_eventually(name, &blk) def should_eventually(name, &blk)
context_name = self.name.gsub(/Test/, "") context_name = self.name.gsub(/Test/, "")
context = Thoughtbot::Shoulda::Context.new(context_name, self) do context = Shoulda::Context.new(context_name, self) do
should_eventually(name, &blk) should_eventually(name, &blk)
end end
context.build context.build
@ -114,7 +113,7 @@ module Thoughtbot
if Shoulda.current_context if Shoulda.current_context
Shoulda.current_context.context(name, &blk) Shoulda.current_context.context(name, &blk)
else else
context = Thoughtbot::Shoulda::Context.new(name, self, &blk) context = Shoulda::Context.new(name, self, &blk)
context.build context.build
end end
end end
@ -229,12 +228,11 @@ module Thoughtbot
end end
end end
end
module Test # :nodoc: all module Test # :nodoc: all
module Unit module Unit
class TestCase class TestCase
extend Thoughtbot::Shoulda extend Shoulda
end end
end end
end end

View File

@ -1,9 +1,8 @@
module ThoughtBot # :nodoc:
module Shoulda # :nodoc: module Shoulda # :nodoc:
module General module General
def self.included(other) # :nodoc: def self.included(other) # :nodoc:
other.class_eval do other.class_eval do
extend ThoughtBot::Shoulda::General::ClassMethods extend Shoulda::General::ClassMethods
end end
end end
@ -115,4 +114,3 @@ module ThoughtBot # :nodoc:
end end
end end
end

View File

@ -1,4 +1,3 @@
module ThoughtBot # :nodoc:
module Shoulda # :nodoc: module Shoulda # :nodoc:
module Private # :nodoc: module Private # :nodoc:
# Returns the values for the entries in the args hash who's keys are listed in the wanted array. # Returns the values for the entries in the args hash who's keys are listed in the wanted array.
@ -19,4 +18,3 @@ module ThoughtBot # :nodoc:
end end
end end
end end
end

View File

@ -1,7 +1,7 @@
require File.join(File.dirname(__FILE__), '..', 'test_helper') require File.join(File.dirname(__FILE__), '..', 'test_helper')
class PrivateHelpersTest < Test::Unit::TestCase # :nodoc: class PrivateHelpersTest < Test::Unit::TestCase # :nodoc:
include ThoughtBot::Shoulda::ActiveRecord include Shoulda::ActiveRecord
context "get_options!" do context "get_options!" do
should "remove opts from args" do should "remove opts from args" do
args = [:a, :b, {}] args = [:a, :b, {}]