diff options
| author | AnastasiaSulyagina | 2016-08-18 22:11:42 +0300 |
|---|---|---|
| committer | AnastasiaSulyagina | 2016-08-19 14:50:14 +0300 |
| commit | e81f4ab7deeb40308f240be5ea00091fc8786d7a (patch) | |
| tree | b5418f9149de71c0f05f90cb2b39ab47f46e27b4 /Library/Homebrew/cask/test/support/shared_examples.rb | |
| parent | 5c7c9de669025bbe4cad9829be39c5cf3b31ad25 (diff) | |
| download | brew-e81f4ab7deeb40308f240be5ea00091fc8786d7a.tar.bz2 | |
init
Diffstat (limited to 'Library/Homebrew/cask/test/support/shared_examples.rb')
| -rw-r--r-- | Library/Homebrew/cask/test/support/shared_examples.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/test/support/shared_examples.rb b/Library/Homebrew/cask/test/support/shared_examples.rb new file mode 100644 index 000000000..e846af404 --- /dev/null +++ b/Library/Homebrew/cask/test/support/shared_examples.rb @@ -0,0 +1,21 @@ +# Adapted from https://gist.github.com/jodosha/1560208 +MiniTest::Spec.class_eval do + def self.shared_examples + @shared_examples ||= {} + end +end + +module MiniTest::Spec::SharedExamples + def shared_examples_for(desc, &block) + MiniTest::Spec.shared_examples[desc] = block + end + + def it_behaves_like(desc, *args, &block) + instance_exec(*args, &MiniTest::Spec.shared_examples[desc]) + instance_eval(&block) if block_given? + end +end + +Object.class_eval do + include(MiniTest::Spec::SharedExamples) +end |
