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
=== Context Helpers (ThoughtBot::Shoulda::Context)
=== Context Helpers (Shoulda::Context)
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!
=== ActiveRecord Tests (ThoughtBot::Shoulda::ActiveRecord)
=== ActiveRecord Tests (Shoulda::ActiveRecord)
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.
=== Controller Tests (ThoughtBot::Shoulda::Controller::ClassMethods)
=== Controller Tests (Shoulda::Controller::ClassMethods)
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.
=== Helpful Assertions (ThoughtBot::Shoulda::General)
=== Helpful Assertions (Shoulda::General)
More to come here, but have fun with what's there.

View File

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

View File

@ -1,4 +1,3 @@
module ThoughtBot # :nodoc:
module Shoulda # :nodoc:
# = Macro test helpers for your active record models
#
@ -598,7 +597,6 @@ module ThoughtBot # :nodoc:
private
include ThoughtBot::Shoulda::Private
end
include Shoulda::Private
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.
# A fix would be most welcome.
#
module ThoughtBot::Shoulda::Color
module Shoulda::Color
COLORS = { :clear => 0, :red => 31, :green => 32, :yellow => 33 } # :nodoc:
def self.method_missing(color_name, *args) # :nodoc:
color(color_name) + args.first + color(:clear)
@ -25,7 +25,7 @@ module Test # :nodoc:
alias :old_to_s :to_s
def to_s
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
@ -43,16 +43,16 @@ module Test # :nodoc:
class Failure # :nodoc:
alias :old_long_display :long_display
def long_display
# old_long_display.sub('Failure', ThoughtBot::Shoulda::Color.red('Failure'))
ThoughtBot::Shoulda::Color.red(old_long_display)
# old_long_display.sub('Failure', Shoulda::Color.red('Failure'))
Shoulda::Color.red(old_long_display)
end
end
class Error # :nodoc:
alias :old_long_display :long_display
def long_display
# old_long_display.sub('Error', ThoughtBot::Shoulda::Color.yellow('Error'))
ThoughtBot::Shoulda::Color.yellow(old_long_display)
# old_long_display.sub('Error', Shoulda::Color.yellow('Error'))
Shoulda::Color.yellow(old_long_display)
end
end
@ -62,9 +62,9 @@ module Test # :nodoc:
def output_single(something, level=NORMAL)
return unless (output?(level))
something = case something
when '.' then ThoughtBot::Shoulda::Color.green('.')
when 'F' then ThoughtBot::Shoulda::Color.red("F")
when 'E' then ThoughtBot::Shoulda::Color.yellow("E")
when '.' then Shoulda::Color.green('.')
when 'F' then Shoulda::Color.red("F")
when 'E' then Shoulda::Color.yellow("E")
else something
end
@io.write(something)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,3 @@
module ThoughtBot # :nodoc:
module Shoulda # :nodoc:
module Private # :nodoc:
# 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

View File

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