Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Revert "minitest provides "it" and "describe""
This reverts commit 22bc12e. REASON: We will remove the MiniTest::Spec from Rails and we need these methods again Conflicts: activesupport/lib/active_support/test_case.rb
- Loading branch information
1 parent
5e51074
commit d58d71f565848cccc1a3fa4ae504559042146c42
Showing
2 changed files
with
42 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| module ActiveSupport | ||
| module Testing | ||
| module Declarative | ||
|
|
||
| def self.extended(klass) #:nodoc: | ||
| klass.class_eval do | ||
|
|
||
| unless method_defined?(:describe) | ||
| def self.describe(text) | ||
| class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 | ||
| def self.name | ||
| "#{text}" | ||
| end | ||
| RUBY_EVAL | ||
| end | ||
| end | ||
|
|
||
| end | ||
| end | ||
|
|
||
| unless defined?(Spec) | ||
| # test "verify something" do | ||
| # ... | ||
| # end | ||
| def test(name, &block) | ||
| test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym | ||
| defined = instance_method(test_name) rescue false | ||
| raise "#{test_name} is already defined in #{self}" if defined | ||
| if block_given? | ||
| define_method(test_name, &block) | ||
| else | ||
| define_method(test_name) do | ||
| flunk "No implementation provided for #{name}" | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end |