simple-templater 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +10 -0
- data/LICENSE +20 -0
- data/README.textile +136 -0
- data/Rakefile +79 -0
- data/TODO.txt +15 -0
- data/bin/simple-templater +66 -0
- data/deps.rip +7 -0
- data/lib/simple-templater/argv_parsing.rb +27 -0
- data/lib/simple-templater/builder.rb +134 -0
- data/lib/simple-templater/discoverer.rb +20 -0
- data/lib/simple-templater/discoverers/gems.rb +79 -0
- data/lib/simple-templater/discoverers/plain.rb +1 -0
- data/lib/simple-templater/discoverers/rip.rb +1 -0
- data/lib/simple-templater/dsl.rb +27 -0
- data/lib/simple-templater/generator.rb +129 -0
- data/lib/simple-templater/generator_set.rb +45 -0
- data/lib/simple-templater/helpers.rb +34 -0
- data/lib/simple-templater/hooks/hook.rb +76 -0
- data/lib/simple-templater/hooks/postprocess/git_repository.rb +25 -0
- data/lib/simple-templater/hooks/postprocess/github.rb +20 -0
- data/lib/simple-templater/hooks/preprocess/full_name.rb +17 -0
- data/lib/simple-templater/hooks/preprocess/github.rb +25 -0
- data/lib/simple-templater.rb +97 -0
- data/script/spec +14 -0
- data/simple-templater.gemspec +45 -0
- data/simple-templater.scope +6 -0
- data/spec/simple-templater/argv_parsing_spec.rb +41 -0
- data/spec/simple-templater/builder_spec.rb +1 -0
- data/spec/simple-templater/discoverers/gems_spec.rb +0 -0
- data/spec/simple-templater/discoverers/plain_spec.rb +0 -0
- data/spec/simple-templater/discoverers/rip_spec.rb +0 -0
- data/spec/simple-templater/generator_set_spec.rb +55 -0
- data/spec/simple-templater/generator_spec.rb +30 -0
- data/spec/simple-templater/helpers_spec.rb +81 -0
- data/spec/simple-templater/hooks/hook_spec.rb +100 -0
- data/spec/simple-templater/hooks/postprocess/git_repository_spec.rb +25 -0
- data/spec/simple-templater/hooks/postprocess/github_spec.rb +8 -0
- data/spec/simple-templater_spec.rb +112 -0
- data/spec/spec.opts +5 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/stubs/gems/cache/test_generator-0.0.1.gem +0 -0
- data/spec/stubs/gems/gems/test_generator-0.0.1/simple-generator.scope +8 -0
- data/spec/stubs/gems/gems/test_generator-0.0.1/simple-templater.scope +8 -0
- data/spec/stubs/gems/gems/test_generator-0.0.1/stubs/content/%name%1_test.rb.rbt +1 -0
- data/spec/stubs/gems/gems/test_generator-0.0.1/stubs/content/%name%_test.rb +0 -0
- data/spec/stubs/gems/gems/test_generator-0.0.1/stubs/content/README.textile +3 -0
- data/spec/stubs/gems/gems/test_generator-0.0.1/stubs/content/script.rb.rbt +1 -0
- data/spec/stubs/gems/gems/test_generator-0.0.1/stubs/test/content/%name%1_test.rb.rbt +1 -0
- data/spec/stubs/gems/gems/test_generator-0.0.1/stubs/test/content/%name%_test.rb +0 -0
- data/spec/stubs/gems/gems/test_generator-0.0.1/stubs/test/content/README.textile +3 -0
- data/spec/stubs/gems/gems/test_generator-0.0.1/stubs/test/content/script.rb.rbt +1 -0
- data/spec/stubs/gems/gems/test_generator-0.0.1/test_generator.gemspec +19 -0
- data/spec/stubs/gems/specifications/test_generator-0.0.1.gemspec +28 -0
- data/spec/stubs/simple-templater.scope +8 -0
- data/spec/stubs/test_generator/simple-templater.scope +8 -0
- data/spec/stubs/test_generator/stubs/test/content/%name%1_test.rb.rbt +1 -0
- data/spec/stubs/test_generator/stubs/test/content/%name%_test.rb +0 -0
- data/spec/stubs/test_generator/stubs/test/content/README.textile +3 -0
- data/spec/stubs/test_generator/stubs/test/content/script.rb.rbt +1 -0
- data/spec/stubs/test_generator/test_generator-0.0.1.gem +0 -0
- data/spec/stubs/test_generator/test_generator.gemspec +19 -0
- data/stubs/project/content/%name%.gemspec.rbt +37 -0
- data/stubs/project/content/CHANGELOG +2 -0
- data/stubs/project/content/LICENSE.rbt +20 -0
- data/stubs/project/content/README.textile.rbt +19 -0
- data/stubs/project/content/Rakefile +39 -0
- data/stubs/project/content/TODO.txt +0 -0
- data/stubs/project/content/bin/%name%.rbt +14 -0
- data/stubs/project/content/deps.rip +5 -0
- data/stubs/project/content/lib/%name%.rb.rbt +5 -0
- data/stubs/project/content/spec/%name%_spec.rb.rbt +10 -0
- data/stubs/project/content/spec/spec.opts +5 -0
- data/stubs/project/content/spec/spec_helper.rb.rbt +11 -0
- data/stubs/project/metadata.yml +3 -0
- data/stubs/project/postprocess.rb +13 -0
- data/stubs/project/setup.rb +13 -0
- data/stubs/stub/content/metadata.yml.rbt +3 -0
- data/stubs/stub/content/postprocess.rb +11 -0
- data/stubs/stub/content/setup.rb +10 -0
- data/stubs/stub/metadata.yml +3 -0
- data/stubs/stub/postprocess.rb +9 -0
- data/stubs/stub/setup.rb +15 -0
- data/vendor/abstract/ChangeLog +3 -0
- data/vendor/abstract/README.txt +57 -0
- data/vendor/abstract/abstract.gemspec +48 -0
- data/vendor/abstract/doc/classes/Kernel.html +134 -0
- data/vendor/abstract/doc/classes/Kernel.src/M000002.html +24 -0
- data/vendor/abstract/doc/classes/Module.html +140 -0
- data/vendor/abstract/doc/classes/Module.src/M000001.html +20 -0
- data/vendor/abstract/doc/created.rid +1 -0
- data/vendor/abstract/doc/files/README_txt.html +173 -0
- data/vendor/abstract/doc/files/lib/abstract_rb.html +137 -0
- data/vendor/abstract/doc/fr_class_index.html +28 -0
- data/vendor/abstract/doc/fr_file_index.html +28 -0
- data/vendor/abstract/doc/fr_method_index.html +28 -0
- data/vendor/abstract/doc/index.html +24 -0
- data/vendor/abstract/doc/rdoc-style.css +208 -0
- data/vendor/abstract/lib/abstract.rb +75 -0
- data/vendor/abstract/setup.rb +1331 -0
- data/vendor/abstract/test/test.rb +91 -0
- data/vendor/cli/CHANGELOG +2 -0
- data/vendor/cli/LICENSE +20 -0
- data/vendor/cli/README.textile +0 -0
- data/vendor/cli/Rakefile +62 -0
- data/vendor/cli/TODO.txt +0 -0
- data/vendor/cli/cli.gemspec +42 -0
- data/vendor/cli/deps.rip +5 -0
- data/vendor/cli/lib/cli.rb +33 -0
- data/vendor/cli/script/spec +12 -0
- data/vendor/cli/spec/cli_spec.rb +56 -0
- data/vendor/cli/spec/spec.opts +5 -0
- data/vendor/cli/spec/spec_helper.rb +18 -0
- data/vendor/erubis/CHANGES.txt +717 -0
- data/vendor/erubis/MIT-LICENSE +20 -0
- data/vendor/erubis/README.txt +102 -0
- data/vendor/erubis/benchmark/Makefile +6 -0
- data/vendor/erubis/benchmark/bench.rb +314 -0
- data/vendor/erubis/benchmark/bench_context.yaml +141 -0
- data/vendor/erubis/benchmark/templates/_footer.html +4 -0
- data/vendor/erubis/benchmark/templates/_header.html +52 -0
- data/vendor/erubis/benchmark/templates/bench_erb.rhtml +29 -0
- data/vendor/erubis/benchmark/templates/bench_erubis.rhtml +29 -0
- data/vendor/erubis/benchmark/templates/bench_eruby.rhtml +29 -0
- data/vendor/erubis/bin/erubis +11 -0
- data/vendor/erubis/contrib/erubis +11 -0
- data/vendor/erubis/contrib/erubis-run.rb +132 -0
- data/vendor/erubis/contrib/inline-require +153 -0
- data/vendor/erubis/doc/docstyle.css +188 -0
- data/vendor/erubis/doc/users-guide.html +3285 -0
- data/vendor/erubis/doc-api/classes/ActionView/TemplateHandlers/ErubisHandler.html +181 -0
- data/vendor/erubis/doc-api/classes/ActionView.html +105 -0
- data/vendor/erubis/doc-api/classes/ERB.html +101 -0
- data/vendor/erubis/doc-api/classes/Erubis/ArrayBufferEnhancer.html +175 -0
- data/vendor/erubis/doc-api/classes/Erubis/ArrayBufferEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/ArrayEnhancer.html +174 -0
- data/vendor/erubis/doc-api/classes/Erubis/ArrayEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/Basic/Converter.html +327 -0
- data/vendor/erubis/doc-api/classes/Erubis/Basic/Engine.html +130 -0
- data/vendor/erubis/doc-api/classes/Erubis/Basic.html +112 -0
- data/vendor/erubis/doc-api/classes/Erubis/BiPatternEnhancer.html +215 -0
- data/vendor/erubis/doc-api/classes/Erubis/BiPatternEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/CGenerator.html +386 -0
- data/vendor/erubis/doc-api/classes/Erubis/CommandOptionError.html +113 -0
- data/vendor/erubis/doc-api/classes/Erubis/Context.html +344 -0
- data/vendor/erubis/doc-api/classes/Erubis/Converter.html +283 -0
- data/vendor/erubis/doc-api/classes/Erubis/DeleteIndentEnhancer.html +150 -0
- data/vendor/erubis/doc-api/classes/Erubis/DeleteIndentEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/Ec.html +126 -0
- data/vendor/erubis/doc-api/classes/Erubis/Ejava.html +126 -0
- data/vendor/erubis/doc-api/classes/Erubis/Ejavascript.html +126 -0
- data/vendor/erubis/doc-api/classes/Erubis/Engine.html +305 -0
- data/vendor/erubis/doc-api/classes/Erubis/Eperl.html +126 -0
- data/vendor/erubis/doc-api/classes/Erubis/Ephp.html +126 -0
- data/vendor/erubis/doc-api/classes/Erubis/ErboutEnhancer.html +175 -0
- data/vendor/erubis/doc-api/classes/Erubis/ErboutEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/ErubisError.html +117 -0
- data/vendor/erubis/doc-api/classes/Erubis/Eruby.html +132 -0
- data/vendor/erubis/doc-api/classes/Erubis/EscapeEnhancer.html +165 -0
- data/vendor/erubis/doc-api/classes/Erubis/EscapedEc.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/EscapedEjava.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/EscapedEjavascript.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/EscapedEperl.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/EscapedEphp.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/EscapedEruby.html +127 -0
- data/vendor/erubis/doc-api/classes/Erubis/EscapedEscheme.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/Escheme.html +126 -0
- data/vendor/erubis/doc-api/classes/Erubis/Evaluator.html +212 -0
- data/vendor/erubis/doc-api/classes/Erubis/FastEruby.html +131 -0
- data/vendor/erubis/doc-api/classes/Erubis/Generator.html +416 -0
- data/vendor/erubis/doc-api/classes/Erubis/HeaderFooterEnhancer.html +267 -0
- data/vendor/erubis/doc-api/classes/Erubis/HeaderFooterEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/Helpers/RailsFormHelper.html +787 -0
- data/vendor/erubis/doc-api/classes/Erubis/Helpers/RailsHelper/TemplateConverter.html +164 -0
- data/vendor/erubis/doc-api/classes/Erubis/Helpers/RailsHelper.html +349 -0
- data/vendor/erubis/doc-api/classes/Erubis/Helpers.html +116 -0
- data/vendor/erubis/doc-api/classes/Erubis/InterpolationEnhancer.html +306 -0
- data/vendor/erubis/doc-api/classes/Erubis/InterpolationEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/JavaGenerator.html +359 -0
- data/vendor/erubis/doc-api/classes/Erubis/JavascriptGenerator.html +386 -0
- data/vendor/erubis/doc-api/classes/Erubis/Main.html +340 -0
- data/vendor/erubis/doc-api/classes/Erubis/NoCodeEnhancer.html +249 -0
- data/vendor/erubis/doc-api/classes/Erubis/NoCodeEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/NoTextEnhancer.html +159 -0
- data/vendor/erubis/doc-api/classes/Erubis/NoTextEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/NotSupportedError.html +119 -0
- data/vendor/erubis/doc-api/classes/Erubis/OptimizedEruby.html +163 -0
- data/vendor/erubis/doc-api/classes/Erubis/OptimizedGenerator.html +439 -0
- data/vendor/erubis/doc-api/classes/Erubis/OptimizedXmlEruby.html +163 -0
- data/vendor/erubis/doc-api/classes/Erubis/PI/Converter.html +266 -0
- data/vendor/erubis/doc-api/classes/Erubis/PI/Ec.html +166 -0
- data/vendor/erubis/doc-api/classes/Erubis/PI/Ejava.html +166 -0
- data/vendor/erubis/doc-api/classes/Erubis/PI/Ejavascript.html +166 -0
- data/vendor/erubis/doc-api/classes/Erubis/PI/Engine.html +122 -0
- data/vendor/erubis/doc-api/classes/Erubis/PI/Eperl.html +166 -0
- data/vendor/erubis/doc-api/classes/Erubis/PI/Ephp.html +166 -0
- data/vendor/erubis/doc-api/classes/Erubis/PI/Eruby.html +155 -0
- data/vendor/erubis/doc-api/classes/Erubis/PI/Escheme.html +166 -0
- data/vendor/erubis/doc-api/classes/Erubis/PI/TinyEruby.html +293 -0
- data/vendor/erubis/doc-api/classes/Erubis/PI.html +124 -0
- data/vendor/erubis/doc-api/classes/Erubis/PercentLineEnhancer.html +179 -0
- data/vendor/erubis/doc-api/classes/Erubis/PercentLineEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/PerlGenerator.html +344 -0
- data/vendor/erubis/doc-api/classes/Erubis/PhpGenerator.html +350 -0
- data/vendor/erubis/doc-api/classes/Erubis/PreprocessingEruby.html +183 -0
- data/vendor/erubis/doc-api/classes/Erubis/PreprocessingHelper.html +212 -0
- data/vendor/erubis/doc-api/classes/Erubis/PrintEnabledEnhancer.html +212 -0
- data/vendor/erubis/doc-api/classes/Erubis/PrintEnabledEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/PrintOutEnhancer.html +244 -0
- data/vendor/erubis/doc-api/classes/Erubis/PrintOutEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/PrintOutSimplifiedEruby.html +121 -0
- data/vendor/erubis/doc-api/classes/Erubis/RubyEvaluator.html +227 -0
- data/vendor/erubis/doc-api/classes/Erubis/RubyGenerator.html +327 -0
- data/vendor/erubis/doc-api/classes/Erubis/SchemeGenerator.html +382 -0
- data/vendor/erubis/doc-api/classes/Erubis/SimplifiedEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/SimplifyEnhancer.html +191 -0
- data/vendor/erubis/doc-api/classes/Erubis/StdoutEnhancer.html +173 -0
- data/vendor/erubis/doc-api/classes/Erubis/StdoutEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/StdoutSimplifiedEruby.html +121 -0
- data/vendor/erubis/doc-api/classes/Erubis/StringBufferEnhancer.html +174 -0
- data/vendor/erubis/doc-api/classes/Erubis/StringBufferEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/StringIOEruby.html +120 -0
- data/vendor/erubis/doc-api/classes/Erubis/TinyEruby.html +299 -0
- data/vendor/erubis/doc-api/classes/Erubis/XmlEruby.html +130 -0
- data/vendor/erubis/doc-api/classes/Erubis/XmlHelper.html +255 -0
- data/vendor/erubis/doc-api/classes/Erubis.html +353 -0
- data/vendor/erubis/doc-api/created.rid +1 -0
- data/vendor/erubis/doc-api/files/README_txt.html +247 -0
- data/vendor/erubis/doc-api/files/erubis/context_rb.html +107 -0
- data/vendor/erubis/doc-api/files/erubis/converter_rb.html +114 -0
- data/vendor/erubis/doc-api/files/erubis/engine/ec_rb.html +115 -0
- data/vendor/erubis/doc-api/files/erubis/engine/ejava_rb.html +115 -0
- data/vendor/erubis/doc-api/files/erubis/engine/ejavascript_rb.html +115 -0
- data/vendor/erubis/doc-api/files/erubis/engine/enhanced_rb.html +115 -0
- data/vendor/erubis/doc-api/files/erubis/engine/eperl_rb.html +115 -0
- data/vendor/erubis/doc-api/files/erubis/engine/ephp_rb.html +115 -0
- data/vendor/erubis/doc-api/files/erubis/engine/eruby_rb.html +115 -0
- data/vendor/erubis/doc-api/files/erubis/engine/escheme_rb.html +115 -0
- data/vendor/erubis/doc-api/files/erubis/engine/optimized_rb.html +114 -0
- data/vendor/erubis/doc-api/files/erubis/engine_rb.html +117 -0
- data/vendor/erubis/doc-api/files/erubis/enhancer_rb.html +107 -0
- data/vendor/erubis/doc-api/files/erubis/error_rb.html +107 -0
- data/vendor/erubis/doc-api/files/erubis/evaluator_rb.html +115 -0
- data/vendor/erubis/doc-api/files/erubis/generator_rb.html +114 -0
- data/vendor/erubis/doc-api/files/erubis/helper_rb.html +107 -0
- data/vendor/erubis/doc-api/files/erubis/helpers/rails_form_helper_rb.html +107 -0
- data/vendor/erubis/doc-api/files/erubis/helpers/rails_helper_rb.html +116 -0
- data/vendor/erubis/doc-api/files/erubis/local-setting_rb.html +107 -0
- data/vendor/erubis/doc-api/files/erubis/main_rb.html +127 -0
- data/vendor/erubis/doc-api/files/erubis/preprocessing_rb.html +114 -0
- data/vendor/erubis/doc-api/files/erubis/tiny_rb.html +107 -0
- data/vendor/erubis/doc-api/files/erubis_rb.html +118 -0
- data/vendor/erubis/doc-api/fr_class_index.html +122 -0
- data/vendor/erubis/doc-api/fr_file_index.html +51 -0
- data/vendor/erubis/doc-api/fr_method_index.html +248 -0
- data/vendor/erubis/doc-api/index.html +24 -0
- data/vendor/erubis/doc-api/rdoc-style.css +208 -0
- data/vendor/erubis/erubis.gemspec +66 -0
- data/vendor/erubis/examples/basic/Makefile +53 -0
- data/vendor/erubis/examples/basic/example.ec +42 -0
- data/vendor/erubis/examples/basic/example.ejava +45 -0
- data/vendor/erubis/examples/basic/example.ejs +16 -0
- data/vendor/erubis/examples/basic/example.eperl +16 -0
- data/vendor/erubis/examples/basic/example.ephp +17 -0
- data/vendor/erubis/examples/basic/example.eruby +15 -0
- data/vendor/erubis/examples/basic/example.escheme +26 -0
- data/vendor/erubis/examples/pi/Makefile +54 -0
- data/vendor/erubis/examples/pi/example.ec +42 -0
- data/vendor/erubis/examples/pi/example.ejava +45 -0
- data/vendor/erubis/examples/pi/example.ejs +16 -0
- data/vendor/erubis/examples/pi/example.eperl +16 -0
- data/vendor/erubis/examples/pi/example.ephp +17 -0
- data/vendor/erubis/examples/pi/example.eruby +15 -0
- data/vendor/erubis/examples/pi/example.escheme +26 -0
- data/vendor/erubis/lib/erubis/context.rb +84 -0
- data/vendor/erubis/lib/erubis/converter.rb +358 -0
- data/vendor/erubis/lib/erubis/engine/ec.rb +118 -0
- data/vendor/erubis/lib/erubis/engine/ejava.rb +111 -0
- data/vendor/erubis/lib/erubis/engine/ejavascript.rb +120 -0
- data/vendor/erubis/lib/erubis/engine/enhanced.rb +122 -0
- data/vendor/erubis/lib/erubis/engine/eperl.rb +96 -0
- data/vendor/erubis/lib/erubis/engine/ephp.rb +100 -0
- data/vendor/erubis/lib/erubis/engine/eruby.rb +125 -0
- data/vendor/erubis/lib/erubis/engine/escheme.rb +115 -0
- data/vendor/erubis/lib/erubis/engine/optimized.rb +128 -0
- data/vendor/erubis/lib/erubis/engine.rb +121 -0
- data/vendor/erubis/lib/erubis/enhancer.rb +681 -0
- data/vendor/erubis/lib/erubis/error.rb +24 -0
- data/vendor/erubis/lib/erubis/evaluator.rb +89 -0
- data/vendor/erubis/lib/erubis/generator.rb +86 -0
- data/vendor/erubis/lib/erubis/helper.rb +48 -0
- data/vendor/erubis/lib/erubis/helpers/rails_form_helper.rb +198 -0
- data/vendor/erubis/lib/erubis/helpers/rails_helper.rb +325 -0
- data/vendor/erubis/lib/erubis/local-setting.rb +10 -0
- data/vendor/erubis/lib/erubis/main.rb +491 -0
- data/vendor/erubis/lib/erubis/preprocessing.rb +59 -0
- data/vendor/erubis/lib/erubis/tiny.rb +146 -0
- data/vendor/erubis/lib/erubis.rb +73 -0
- data/vendor/erubis/setup.rb +1331 -0
- data/vendor/erubis/test/assert-text-equal.rb +45 -0
- data/vendor/erubis/test/assert-text-equal.rbc +0 -0
- data/vendor/erubis/test/data/users-guide/Example.ejava +55 -0
- data/vendor/erubis/test/data/users-guide/array_example.result +9 -0
- data/vendor/erubis/test/data/users-guide/arraybuffer_example.result +9 -0
- data/vendor/erubis/test/data/users-guide/bipattern-example.rhtml +4 -0
- data/vendor/erubis/test/data/users-guide/bipattern_example.result +6 -0
- data/vendor/erubis/test/data/users-guide/context.rb +6 -0
- data/vendor/erubis/test/data/users-guide/context.yaml +8 -0
- data/vendor/erubis/test/data/users-guide/def_method.rb +14 -0
- data/vendor/erubis/test/data/users-guide/def_method.result +3 -0
- data/vendor/erubis/test/data/users-guide/escape_example.result +9 -0
- data/vendor/erubis/test/data/users-guide/example.ec +27 -0
- data/vendor/erubis/test/data/users-guide/example.ejs +20 -0
- data/vendor/erubis/test/data/users-guide/example.eperl +18 -0
- data/vendor/erubis/test/data/users-guide/example.ephp +18 -0
- data/vendor/erubis/test/data/users-guide/example.eruby +6 -0
- data/vendor/erubis/test/data/users-guide/example.escheme +28 -0
- data/vendor/erubis/test/data/users-guide/example1.eruby +6 -0
- data/vendor/erubis/test/data/users-guide/example1.rb +17 -0
- data/vendor/erubis/test/data/users-guide/example1.result +16 -0
- data/vendor/erubis/test/data/users-guide/example10.rb +4 -0
- data/vendor/erubis/test/data/users-guide/example10.result +17 -0
- data/vendor/erubis/test/data/users-guide/example10.xhtml +14 -0
- data/vendor/erubis/test/data/users-guide/example10_x.result +17 -0
- data/vendor/erubis/test/data/users-guide/example11.php +20 -0
- data/vendor/erubis/test/data/users-guide/example11.result +23 -0
- data/vendor/erubis/test/data/users-guide/example11.rhtml +21 -0
- data/vendor/erubis/test/data/users-guide/example11_C.result +10 -0
- data/vendor/erubis/test/data/users-guide/example11_N.result +16 -0
- data/vendor/erubis/test/data/users-guide/example11_U.result +16 -0
- data/vendor/erubis/test/data/users-guide/example11_php.result +15 -0
- data/vendor/erubis/test/data/users-guide/example1_x.result +9 -0
- data/vendor/erubis/test/data/users-guide/example2.eruby +7 -0
- data/vendor/erubis/test/data/users-guide/example2.rb +10 -0
- data/vendor/erubis/test/data/users-guide/example2.result +27 -0
- data/vendor/erubis/test/data/users-guide/example2_trim.result +10 -0
- data/vendor/erubis/test/data/users-guide/example2_x.result +10 -0
- data/vendor/erubis/test/data/users-guide/example3.eruby +6 -0
- data/vendor/erubis/test/data/users-guide/example3.rb +10 -0
- data/vendor/erubis/test/data/users-guide/example31.result +22 -0
- data/vendor/erubis/test/data/users-guide/example32.result +4 -0
- data/vendor/erubis/test/data/users-guide/example3_e.result +8 -0
- data/vendor/erubis/test/data/users-guide/example4.eruby +3 -0
- data/vendor/erubis/test/data/users-guide/example4.rb +11 -0
- data/vendor/erubis/test/data/users-guide/example4.result +10 -0
- data/vendor/erubis/test/data/users-guide/example4_x.result +5 -0
- data/vendor/erubis/test/data/users-guide/example5.eruby +6 -0
- data/vendor/erubis/test/data/users-guide/example5.rb +16 -0
- data/vendor/erubis/test/data/users-guide/example5.result +7 -0
- data/vendor/erubis/test/data/users-guide/example6.rb +12 -0
- data/vendor/erubis/test/data/users-guide/example6.result +7 -0
- data/vendor/erubis/test/data/users-guide/example7.eruby +8 -0
- data/vendor/erubis/test/data/users-guide/example71.result +13 -0
- data/vendor/erubis/test/data/users-guide/example72.result +13 -0
- data/vendor/erubis/test/data/users-guide/example8.eruby +6 -0
- data/vendor/erubis/test/data/users-guide/example8_ruby.result +7 -0
- data/vendor/erubis/test/data/users-guide/example8_yaml.result +7 -0
- data/vendor/erubis/test/data/users-guide/example9.eruby +3 -0
- data/vendor/erubis/test/data/users-guide/example9.rb +8 -0
- data/vendor/erubis/test/data/users-guide/example9.result +9 -0
- data/vendor/erubis/test/data/users-guide/example91.result +5 -0
- data/vendor/erubis/test/data/users-guide/example92.result +4 -0
- data/vendor/erubis/test/data/users-guide/example_c.result +29 -0
- data/vendor/erubis/test/data/users-guide/example_java.result +56 -0
- data/vendor/erubis/test/data/users-guide/example_js.result +22 -0
- data/vendor/erubis/test/data/users-guide/example_perl.result +20 -0
- data/vendor/erubis/test/data/users-guide/example_php.result +19 -0
- data/vendor/erubis/test/data/users-guide/example_scheme.result +30 -0
- data/vendor/erubis/test/data/users-guide/example_scheme_display.result +29 -0
- data/vendor/erubis/test/data/users-guide/fasteruby.rb +11 -0
- data/vendor/erubis/test/data/users-guide/fasteruby.result +38 -0
- data/vendor/erubis/test/data/users-guide/fasteruby.rhtml +15 -0
- data/vendor/erubis/test/data/users-guide/headerfooter-example.eruby +9 -0
- data/vendor/erubis/test/data/users-guide/headerfooter-example2.rb +8 -0
- data/vendor/erubis/test/data/users-guide/headerfooter-example2.rhtml +10 -0
- data/vendor/erubis/test/data/users-guide/headerfooter_example.result +11 -0
- data/vendor/erubis/test/data/users-guide/headerfooter_example2.result +13 -0
- data/vendor/erubis/test/data/users-guide/interpolation_example.result +9 -0
- data/vendor/erubis/test/data/users-guide/main_program1.rb +8 -0
- data/vendor/erubis/test/data/users-guide/main_program1.result +6 -0
- data/vendor/erubis/test/data/users-guide/main_program2.rb +8 -0
- data/vendor/erubis/test/data/users-guide/main_program2.result +6 -0
- data/vendor/erubis/test/data/users-guide/nocode-example.eruby +14 -0
- data/vendor/erubis/test/data/users-guide/nocode-php.result +20 -0
- data/vendor/erubis/test/data/users-guide/nocode_example.result +15 -0
- data/vendor/erubis/test/data/users-guide/normal-eruby-test.eruby +9 -0
- data/vendor/erubis/test/data/users-guide/normal_eruby_test.result +11 -0
- data/vendor/erubis/test/data/users-guide/notext-example.eruby +14 -0
- data/vendor/erubis/test/data/users-guide/notext-example.php +19 -0
- data/vendor/erubis/test/data/users-guide/notext-php.result +20 -0
- data/vendor/erubis/test/data/users-guide/notext_example.result +16 -0
- data/vendor/erubis/test/data/users-guide/percentline-example.rhtml +4 -0
- data/vendor/erubis/test/data/users-guide/percentline_example.result +7 -0
- data/vendor/erubis/test/data/users-guide/printenable_example.result +4 -0
- data/vendor/erubis/test/data/users-guide/printenabled-example.eruby +3 -0
- data/vendor/erubis/test/data/users-guide/printenabled-example.rb +8 -0
- data/vendor/erubis/test/data/users-guide/printstatement_example.result +8 -0
- data/vendor/erubis/test/data/users-guide/simplify_example.result +9 -0
- data/vendor/erubis/test/data/users-guide/stdout_exmple.result +9 -0
- data/vendor/erubis/test/data/users-guide/stringbuffer_example.result +9 -0
- data/vendor/erubis/test/data/users-guide/tail_260.result +4 -0
- data/vendor/erubis/test/data/users-guide/tailnewline.rhtml +3 -0
- data/vendor/erubis/test/data/users-guide/template1.rhtml +4 -0
- data/vendor/erubis/test/data/users-guide/template2.rhtml +4 -0
- data/vendor/erubis/test/hoge.rb +5 -0
- data/vendor/erubis/test/test-engines.rb +370 -0
- data/vendor/erubis/test/test-engines.rbc +0 -0
- data/vendor/erubis/test/test-enhancers.rb +571 -0
- data/vendor/erubis/test/test-erubis.rb +884 -0
- data/vendor/erubis/test/test-erubis.rbc +0 -0
- data/vendor/erubis/test/test-main.rb +674 -0
- data/vendor/erubis/test/test-users-guide.rb +58 -0
- data/vendor/erubis/test/test-users-guide.rbc +0 -0
- data/vendor/erubis/test/test.rb +30 -0
- data/vendor/erubis/test/test.rbc +0 -0
- data/vendor/erubis/test/testutil.rb +101 -0
- data/vendor/erubis/test/testutil.rbc +0 -0
- data/vendor/fakefs/CONTRIBUTORS +17 -0
- data/vendor/fakefs/LICENSE +20 -0
- data/vendor/fakefs/README.markdown +101 -0
- data/vendor/fakefs/Rakefile +47 -0
- data/vendor/fakefs/lib/fakefs/base.rb +38 -0
- data/vendor/fakefs/lib/fakefs/dir.rb +114 -0
- data/vendor/fakefs/lib/fakefs/fake/dir.rb +45 -0
- data/vendor/fakefs/lib/fakefs/fake/file.rb +79 -0
- data/vendor/fakefs/lib/fakefs/fake/symlink.rb +32 -0
- data/vendor/fakefs/lib/fakefs/file.rb +330 -0
- data/vendor/fakefs/lib/fakefs/file_system.rb +136 -0
- data/vendor/fakefs/lib/fakefs/fileutils.rb +129 -0
- data/vendor/fakefs/lib/fakefs/safe.rb +11 -0
- data/vendor/fakefs/lib/fakefs/spec_helpers.rb +46 -0
- data/vendor/fakefs/lib/fakefs/version.rb +9 -0
- data/vendor/fakefs/lib/fakefs.rb +3 -0
- data/vendor/fakefs/spec/fakefs/spec_helpers_spec.rb +57 -0
- data/vendor/fakefs/spec/spec.opts +1 -0
- data/vendor/fakefs/spec/spec_helper.rb +3 -0
- data/vendor/fakefs/test/fake/file_test.rb +88 -0
- data/vendor/fakefs/test/fake/symlink_test.rb +12 -0
- data/vendor/fakefs/test/fakefs_test.rb +1334 -0
- data/vendor/fakefs/test/file/stat_test.rb +70 -0
- data/vendor/fakefs/test/safe_test.rb +42 -0
- data/vendor/fakefs/test/verify.rb +27 -0
- data/vendor/rspec/History.rdoc +1510 -0
- data/vendor/rspec/License.txt +22 -0
- data/vendor/rspec/Manifest.txt +383 -0
- data/vendor/rspec/README.rdoc +55 -0
- data/vendor/rspec/Rakefile +145 -0
- data/vendor/rspec/Ruby1.9.rdoc +31 -0
- data/vendor/rspec/TODO.txt +17 -0
- data/vendor/rspec/Upgrade.rdoc +199 -0
- data/vendor/rspec/bin/autospec +4 -0
- data/vendor/rspec/bin/spec +5 -0
- data/vendor/rspec/cucumber.yml +5 -0
- data/vendor/rspec/examples/failing/README.txt +11 -0
- data/vendor/rspec/examples/failing/diffing_spec.rb +36 -0
- data/vendor/rspec/examples/failing/failing_implicit_docstrings_example.rb +17 -0
- data/vendor/rspec/examples/failing/failure_in_after.rb +10 -0
- data/vendor/rspec/examples/failing/failure_in_before.rb +10 -0
- data/vendor/rspec/examples/failing/mocking_example.rb +38 -0
- data/vendor/rspec/examples/failing/mocking_with_flexmock.rb +26 -0
- data/vendor/rspec/examples/failing/mocking_with_mocha.rb +25 -0
- data/vendor/rspec/examples/failing/mocking_with_rr.rb +27 -0
- data/vendor/rspec/examples/failing/partial_mock_example.rb +18 -0
- data/vendor/rspec/examples/failing/pending_example.rb +7 -0
- data/vendor/rspec/examples/failing/predicate_example.rb +32 -0
- data/vendor/rspec/examples/failing/raising_example.rb +47 -0
- data/vendor/rspec/examples/failing/syntax_error_example.rb +7 -0
- data/vendor/rspec/examples/failing/team_spec.rb +41 -0
- data/vendor/rspec/examples/failing/timeout_behaviour.rb +5 -0
- data/vendor/rspec/examples/passing/custom_formatter.rb +11 -0
- data/vendor/rspec/examples/passing/custom_matchers.rb +54 -0
- data/vendor/rspec/examples/passing/dynamic_spec.rb +7 -0
- data/vendor/rspec/examples/passing/file_accessor.rb +18 -0
- data/vendor/rspec/examples/passing/file_accessor_spec.rb +37 -0
- data/vendor/rspec/examples/passing/filtered_formatter.rb +17 -0
- data/vendor/rspec/examples/passing/filtered_formatter_example.rb +31 -0
- data/vendor/rspec/examples/passing/greeter_spec.rb +30 -0
- data/vendor/rspec/examples/passing/helper_method_example.rb +12 -0
- data/vendor/rspec/examples/passing/implicit_docstrings_example.rb +16 -0
- data/vendor/rspec/examples/passing/io_processor.rb +8 -0
- data/vendor/rspec/examples/passing/io_processor_spec.rb +20 -0
- data/vendor/rspec/examples/passing/mocking_example.rb +25 -0
- data/vendor/rspec/examples/passing/multi_threaded_example_group_runner.rb +26 -0
- data/vendor/rspec/examples/passing/nested_classes_example.rb +35 -0
- data/vendor/rspec/examples/passing/options_example.rb +29 -0
- data/vendor/rspec/examples/passing/options_formatter.rb +20 -0
- data/vendor/rspec/examples/passing/partial_mock_example.rb +27 -0
- data/vendor/rspec/examples/passing/pending_example.rb +18 -0
- data/vendor/rspec/examples/passing/predicate_example.rb +25 -0
- data/vendor/rspec/examples/passing/shared_example_group_example.rb +79 -0
- data/vendor/rspec/examples/passing/shared_stack_examples.rb +36 -0
- data/vendor/rspec/examples/passing/simple_matcher_example.rb +29 -0
- data/vendor/rspec/examples/passing/stack.rb +36 -0
- data/vendor/rspec/examples/passing/stack_spec.rb +63 -0
- data/vendor/rspec/examples/passing/stack_spec_with_nested_example_groups.rb +66 -0
- data/vendor/rspec/examples/passing/stubbing_example.rb +67 -0
- data/vendor/rspec/examples/passing/yielding_example.rb +31 -0
- data/vendor/rspec/examples/ruby1.9.compatibility/access_to_constants_spec.rb +85 -0
- data/vendor/rspec/features/before_and_after_blocks/before_and_after_blocks.feature +167 -0
- data/vendor/rspec/features/command_line/line_number_option.feature +56 -0
- data/vendor/rspec/features/command_line/line_number_option_with_example_with_no_name.feature +22 -0
- data/vendor/rspec/features/example_groups/define_example_attribute.feature +41 -0
- data/vendor/rspec/features/example_groups/example_group_with_should_methods.feature +29 -0
- data/vendor/rspec/features/example_groups/implicit_docstrings.feature +59 -0
- data/vendor/rspec/features/example_groups/nested_groups.feature +32 -0
- data/vendor/rspec/features/expectations/customized_message.feature +54 -0
- data/vendor/rspec/features/expectations/expect_change.feature +65 -0
- data/vendor/rspec/features/expectations/expect_error.feature +44 -0
- data/vendor/rspec/features/extensions/custom_example_group.feature +19 -0
- data/vendor/rspec/features/formatters/custom_formatter.feature +30 -0
- data/vendor/rspec/features/interop/examples_and_tests_together.feature +84 -0
- data/vendor/rspec/features/interop/rspec_output.feature +25 -0
- data/vendor/rspec/features/interop/test_but_not_test_unit.feature +26 -0
- data/vendor/rspec/features/interop/test_case_with_should_methods.feature +46 -0
- data/vendor/rspec/features/load_paths/add_lib_to_load_path.feature +20 -0
- data/vendor/rspec/features/load_paths/add_spec_to_load_path.feature +20 -0
- data/vendor/rspec/features/matchers/define_diffable_matcher.feature +26 -0
- data/vendor/rspec/features/matchers/define_matcher.feature +179 -0
- data/vendor/rspec/features/matchers/define_matcher_outside_rspec.feature +38 -0
- data/vendor/rspec/features/matchers/define_matcher_with_fluent_interface.feature +27 -0
- data/vendor/rspec/features/matchers/define_wrapped_matcher.feature +29 -0
- data/vendor/rspec/features/matchers/match_unless_raises.feature +60 -0
- data/vendor/rspec/features/matchers/match_unless_raises_unexpected_error.feature +39 -0
- data/vendor/rspec/features/mock_framework_integration/use_flexmock.feature +27 -0
- data/vendor/rspec/features/mock_framework_integration/use_mocha.feature +27 -0
- data/vendor/rspec/features/mock_framework_integration/use_rr.feature +27 -0
- data/vendor/rspec/features/mocks/block_local_expectations.feature +62 -0
- data/vendor/rspec/features/mocks/mix_stubs_and_mocks.feature +22 -0
- data/vendor/rspec/features/mocks/stub_implementation.feature +26 -0
- data/vendor/rspec/features/pending/pending_examples.feature +81 -0
- data/vendor/rspec/features/runner/specify_line_number.feature +32 -0
- data/vendor/rspec/features/spec_helper/spec_helper.feature +25 -0
- data/vendor/rspec/features/step_definitions/running_rspec_steps.rb +43 -0
- data/vendor/rspec/features/subject/explicit_subject.feature +31 -0
- data/vendor/rspec/features/subject/implicit_subject.feature +43 -0
- data/vendor/rspec/features/support/env.rb +82 -0
- data/vendor/rspec/features/support/matchers/smart_match.rb +12 -0
- data/vendor/rspec/features-pending/cli/conditional_exclusion.feature +39 -0
- data/vendor/rspec/features-pending/heckle/heckle.feature +56 -0
- data/vendor/rspec/geminstaller.yml +28 -0
- data/vendor/rspec/init.rb +9 -0
- data/vendor/rspec/lib/autotest/discover.rb +3 -0
- data/vendor/rspec/lib/autotest/rspec.rb +54 -0
- data/vendor/rspec/lib/spec/adapters/mock_frameworks/flexmock.rb +24 -0
- data/vendor/rspec/lib/spec/adapters/mock_frameworks/mocha.rb +25 -0
- data/vendor/rspec/lib/spec/adapters/mock_frameworks/rr.rb +22 -0
- data/vendor/rspec/lib/spec/adapters/mock_frameworks/rspec.rb +21 -0
- data/vendor/rspec/lib/spec/autorun.rb +3 -0
- data/vendor/rspec/lib/spec/deprecation.rb +40 -0
- data/vendor/rspec/lib/spec/dsl/main.rb +92 -0
- data/vendor/rspec/lib/spec/dsl.rb +1 -0
- data/vendor/rspec/lib/spec/example/args_and_options.rb +27 -0
- data/vendor/rspec/lib/spec/example/before_and_after_hooks.rb +93 -0
- data/vendor/rspec/lib/spec/example/errors.rb +25 -0
- data/vendor/rspec/lib/spec/example/example_group.rb +10 -0
- data/vendor/rspec/lib/spec/example/example_group_factory.rb +82 -0
- data/vendor/rspec/lib/spec/example/example_group_hierarchy.rb +53 -0
- data/vendor/rspec/lib/spec/example/example_group_methods.rb +282 -0
- data/vendor/rspec/lib/spec/example/example_group_proxy.rb +61 -0
- data/vendor/rspec/lib/spec/example/example_matcher.rb +43 -0
- data/vendor/rspec/lib/spec/example/example_methods.rb +148 -0
- data/vendor/rspec/lib/spec/example/example_proxy.rb +41 -0
- data/vendor/rspec/lib/spec/example/module_reopening_fix.rb +43 -0
- data/vendor/rspec/lib/spec/example/pending.rb +18 -0
- data/vendor/rspec/lib/spec/example/predicate_matchers.rb +46 -0
- data/vendor/rspec/lib/spec/example/shared_example_group.rb +59 -0
- data/vendor/rspec/lib/spec/example/subject.rb +108 -0
- data/vendor/rspec/lib/spec/example.rb +164 -0
- data/vendor/rspec/lib/spec/expectations/errors.rb +12 -0
- data/vendor/rspec/lib/spec/expectations/extensions/kernel.rb +52 -0
- data/vendor/rspec/lib/spec/expectations/extensions.rb +1 -0
- data/vendor/rspec/lib/spec/expectations/fail_with.rb +45 -0
- data/vendor/rspec/lib/spec/expectations/handler.rb +50 -0
- data/vendor/rspec/lib/spec/expectations.rb +35 -0
- data/vendor/rspec/lib/spec/extensions/instance_exec.rb +31 -0
- data/vendor/rspec/lib/spec/interop/test/unit/autorunner.rb +6 -0
- data/vendor/rspec/lib/spec/interop/test/unit/testcase.rb +56 -0
- data/vendor/rspec/lib/spec/interop/test/unit/testresult.rb +6 -0
- data/vendor/rspec/lib/spec/interop/test/unit/testsuite_adapter.rb +34 -0
- data/vendor/rspec/lib/spec/interop/test/unit/ui/console/testrunner.rb +61 -0
- data/vendor/rspec/lib/spec/interop/test.rb +44 -0
- data/vendor/rspec/lib/spec/matchers/be.rb +211 -0
- data/vendor/rspec/lib/spec/matchers/be_close.rb +32 -0
- data/vendor/rspec/lib/spec/matchers/be_instance_of.rb +26 -0
- data/vendor/rspec/lib/spec/matchers/be_kind_of.rb +26 -0
- data/vendor/rspec/lib/spec/matchers/change.rb +151 -0
- data/vendor/rspec/lib/spec/matchers/compatibility.rb +14 -0
- data/vendor/rspec/lib/spec/matchers/dsl.rb +20 -0
- data/vendor/rspec/lib/spec/matchers/eql.rb +42 -0
- data/vendor/rspec/lib/spec/matchers/equal.rb +53 -0
- data/vendor/rspec/lib/spec/matchers/errors.rb +5 -0
- data/vendor/rspec/lib/spec/matchers/exist.rb +16 -0
- data/vendor/rspec/lib/spec/matchers/generated_descriptions.rb +36 -0
- data/vendor/rspec/lib/spec/matchers/has.rb +35 -0
- data/vendor/rspec/lib/spec/matchers/have.rb +152 -0
- data/vendor/rspec/lib/spec/matchers/include.rb +44 -0
- data/vendor/rspec/lib/spec/matchers/match.rb +21 -0
- data/vendor/rspec/lib/spec/matchers/match_array.rb +71 -0
- data/vendor/rspec/lib/spec/matchers/matcher.rb +102 -0
- data/vendor/rspec/lib/spec/matchers/method_missing.rb +9 -0
- data/vendor/rspec/lib/spec/matchers/operator_matcher.rb +78 -0
- data/vendor/rspec/lib/spec/matchers/pretty.rb +37 -0
- data/vendor/rspec/lib/spec/matchers/raise_error.rb +129 -0
- data/vendor/rspec/lib/spec/matchers/respond_to.rb +71 -0
- data/vendor/rspec/lib/spec/matchers/satisfy.rb +47 -0
- data/vendor/rspec/lib/spec/matchers/simple_matcher.rb +133 -0
- data/vendor/rspec/lib/spec/matchers/throw_symbol.rb +104 -0
- data/vendor/rspec/lib/spec/matchers/wrap_expectation.rb +55 -0
- data/vendor/rspec/lib/spec/matchers.rb +195 -0
- data/vendor/rspec/lib/spec/mocks/argument_expectation.rb +51 -0
- data/vendor/rspec/lib/spec/mocks/argument_matchers.rb +237 -0
- data/vendor/rspec/lib/spec/mocks/error_generator.rb +92 -0
- data/vendor/rspec/lib/spec/mocks/errors.rb +10 -0
- data/vendor/rspec/lib/spec/mocks/example_methods.rb +69 -0
- data/vendor/rspec/lib/spec/mocks/extensions/object.rb +3 -0
- data/vendor/rspec/lib/spec/mocks/extensions.rb +1 -0
- data/vendor/rspec/lib/spec/mocks/framework.rb +15 -0
- data/vendor/rspec/lib/spec/mocks/message_expectation.rb +343 -0
- data/vendor/rspec/lib/spec/mocks/methods.rb +89 -0
- data/vendor/rspec/lib/spec/mocks/mock.rb +71 -0
- data/vendor/rspec/lib/spec/mocks/order_group.rb +29 -0
- data/vendor/rspec/lib/spec/mocks/proxy.rb +245 -0
- data/vendor/rspec/lib/spec/mocks/space.rb +28 -0
- data/vendor/rspec/lib/spec/mocks.rb +200 -0
- data/vendor/rspec/lib/spec/rake/spectask.rb +230 -0
- data/vendor/rspec/lib/spec/rake/verify_rcov.rb +52 -0
- data/vendor/rspec/lib/spec/ruby.rb +9 -0
- data/vendor/rspec/lib/spec/runner/backtrace_tweaker.rb +77 -0
- data/vendor/rspec/lib/spec/runner/class_and_arguments_parser.rb +14 -0
- data/vendor/rspec/lib/spec/runner/command_line.rb +15 -0
- data/vendor/rspec/lib/spec/runner/configuration.rb +194 -0
- data/vendor/rspec/lib/spec/runner/differs/default.rb +93 -0
- data/vendor/rspec/lib/spec/runner/differs/load-diff-lcs.rb +12 -0
- data/vendor/rspec/lib/spec/runner/drb_command_line.rb +26 -0
- data/vendor/rspec/lib/spec/runner/example_group_runner.rb +59 -0
- data/vendor/rspec/lib/spec/runner/extensions/kernel.rb +9 -0
- data/vendor/rspec/lib/spec/runner/formatter/base_formatter.rb +139 -0
- data/vendor/rspec/lib/spec/runner/formatter/base_text_formatter.rb +142 -0
- data/vendor/rspec/lib/spec/runner/formatter/failing_example_groups_formatter.rb +25 -0
- data/vendor/rspec/lib/spec/runner/formatter/failing_examples_formatter.rb +20 -0
- data/vendor/rspec/lib/spec/runner/formatter/html_formatter.rb +338 -0
- data/vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb +47 -0
- data/vendor/rspec/lib/spec/runner/formatter/no_op_method_missing.rb +21 -0
- data/vendor/rspec/lib/spec/runner/formatter/profile_formatter.rb +47 -0
- data/vendor/rspec/lib/spec/runner/formatter/progress_bar_formatter.rb +33 -0
- data/vendor/rspec/lib/spec/runner/formatter/silent_formatter.rb +10 -0
- data/vendor/rspec/lib/spec/runner/formatter/snippet_extractor.rb +52 -0
- data/vendor/rspec/lib/spec/runner/formatter/specdoc_formatter.rb +33 -0
- data/vendor/rspec/lib/spec/runner/formatter/text_mate_formatter.rb +16 -0
- data/vendor/rspec/lib/spec/runner/heckle_runner.rb +72 -0
- data/vendor/rspec/lib/spec/runner/heckle_runner_unsupported.rb +10 -0
- data/vendor/rspec/lib/spec/runner/line_number_query.rb +78 -0
- data/vendor/rspec/lib/spec/runner/option_parser.rb +223 -0
- data/vendor/rspec/lib/spec/runner/options.rb +400 -0
- data/vendor/rspec/lib/spec/runner/reporter.rb +171 -0
- data/vendor/rspec/lib/spec/runner.rb +66 -0
- data/vendor/rspec/lib/spec/stubs/cucumber.rb +5 -0
- data/vendor/rspec/lib/spec/test/unit.rb +10 -0
- data/vendor/rspec/lib/spec/version.rb +14 -0
- data/vendor/rspec/lib/spec.rb +8 -0
- data/vendor/rspec/resources/helpers/cmdline.rb +8 -0
- data/vendor/rspec/resources/rake/examples.rake +7 -0
- data/vendor/rspec/resources/rake/examples_with_rcov.rake +9 -0
- data/vendor/rspec/resources/rake/failing_examples_with_html.rake +9 -0
- data/vendor/rspec/resources/rake/verify_rcov.rake +7 -0
- data/vendor/rspec/spec/README.jruby +15 -0
- data/vendor/rspec/spec/autotest/autotest_helper.rb +8 -0
- data/vendor/rspec/spec/autotest/autotest_matchers.rb +38 -0
- data/vendor/rspec/spec/autotest/discover_spec.rb +8 -0
- data/vendor/rspec/spec/autotest/failed_results_re_spec.rb +31 -0
- data/vendor/rspec/spec/autotest/rspec_spec.rb +126 -0
- data/vendor/rspec/spec/ruby_forker.rb +13 -0
- data/vendor/rspec/spec/spec/dsl/main_spec.rb +95 -0
- data/vendor/rspec/spec/spec/example/example_group_class_definition_spec.rb +51 -0
- data/vendor/rspec/spec/spec/example/example_group_factory_spec.rb +180 -0
- data/vendor/rspec/spec/spec/example/example_group_methods_spec.rb +759 -0
- data/vendor/rspec/spec/spec/example/example_group_proxy_spec.rb +107 -0
- data/vendor/rspec/spec/spec/example/example_group_spec.rb +643 -0
- data/vendor/rspec/spec/spec/example/example_matcher_spec.rb +86 -0
- data/vendor/rspec/spec/spec/example/example_methods_spec.rb +162 -0
- data/vendor/rspec/spec/spec/example/example_proxy_spec.rb +57 -0
- data/vendor/rspec/spec/spec/example/helper_method_spec.rb +24 -0
- data/vendor/rspec/spec/spec/example/nested_example_group_spec.rb +71 -0
- data/vendor/rspec/spec/spec/example/pending_module_spec.rb +58 -0
- data/vendor/rspec/spec/spec/example/predicate_matcher_spec.rb +41 -0
- data/vendor/rspec/spec/spec/example/shared_example_group_spec.rb +257 -0
- data/vendor/rspec/spec/spec/example/subclassing_example_group_spec.rb +25 -0
- data/vendor/rspec/spec/spec/example/subject_spec.rb +103 -0
- data/vendor/rspec/spec/spec/expectations/differs/default_spec.rb +194 -0
- data/vendor/rspec/spec/spec/expectations/extensions/kernel_spec.rb +45 -0
- data/vendor/rspec/spec/spec/expectations/fail_with_spec.rb +96 -0
- data/vendor/rspec/spec/spec/expectations/handler_spec.rb +206 -0
- data/vendor/rspec/spec/spec/expectations/wrap_expectation_spec.rb +30 -0
- data/vendor/rspec/spec/spec/interop/test/unit/resources/spec_that_fails.rb +10 -0
- data/vendor/rspec/spec/spec/interop/test/unit/resources/spec_that_passes.rb +10 -0
- data/vendor/rspec/spec/spec/interop/test/unit/resources/spec_with_errors.rb +10 -0
- data/vendor/rspec/spec/spec/interop/test/unit/resources/spec_with_options_hash.rb +13 -0
- data/vendor/rspec/spec/spec/interop/test/unit/resources/test_case_that_fails.rb +10 -0
- data/vendor/rspec/spec/spec/interop/test/unit/resources/test_case_that_passes.rb +10 -0
- data/vendor/rspec/spec/spec/interop/test/unit/resources/test_case_with_errors.rb +10 -0
- data/vendor/rspec/spec/spec/interop/test/unit/resources/test_case_with_various_names.rb +22 -0
- data/vendor/rspec/spec/spec/interop/test/unit/resources/testsuite_adapter_spec_with_test_unit.rb +38 -0
- data/vendor/rspec/spec/spec/interop/test/unit/spec_spec.rb +48 -0
- data/vendor/rspec/spec/spec/interop/test/unit/test_unit_spec_helper.rb +18 -0
- data/vendor/rspec/spec/spec/interop/test/unit/testcase_spec.rb +50 -0
- data/vendor/rspec/spec/spec/interop/test/unit/testsuite_adapter_spec.rb +9 -0
- data/vendor/rspec/spec/spec/matchers/be_close_spec.rb +50 -0
- data/vendor/rspec/spec/spec/matchers/be_instance_of_spec.rb +36 -0
- data/vendor/rspec/spec/spec/matchers/be_kind_of_spec.rb +33 -0
- data/vendor/rspec/spec/spec/matchers/be_spec.rb +419 -0
- data/vendor/rspec/spec/spec/matchers/change_spec.rb +349 -0
- data/vendor/rspec/spec/spec/matchers/compatibility_spec.rb +28 -0
- data/vendor/rspec/spec/spec/matchers/description_generation_spec.rb +160 -0
- data/vendor/rspec/spec/spec/matchers/dsl_spec.rb +34 -0
- data/vendor/rspec/spec/spec/matchers/eql_spec.rb +33 -0
- data/vendor/rspec/spec/spec/matchers/equal_spec.rb +57 -0
- data/vendor/rspec/spec/spec/matchers/exist_spec.rb +65 -0
- data/vendor/rspec/spec/spec/matchers/has_spec.rb +190 -0
- data/vendor/rspec/spec/spec/matchers/have_spec.rb +396 -0
- data/vendor/rspec/spec/spec/matchers/include_spec.rb +88 -0
- data/vendor/rspec/spec/spec/matchers/match_array_spec.rb +108 -0
- data/vendor/rspec/spec/spec/matchers/match_spec.rb +57 -0
- data/vendor/rspec/spec/spec/matchers/matcher_methods_spec.rb +63 -0
- data/vendor/rspec/spec/spec/matchers/matcher_spec.rb +273 -0
- data/vendor/rspec/spec/spec/matchers/matchers_spec.rb +2 -0
- data/vendor/rspec/spec/spec/matchers/operator_matcher_spec.rb +191 -0
- data/vendor/rspec/spec/spec/matchers/raise_error_spec.rb +333 -0
- data/vendor/rspec/spec/spec/matchers/respond_to_spec.rb +116 -0
- data/vendor/rspec/spec/spec/matchers/satisfy_spec.rb +36 -0
- data/vendor/rspec/spec/spec/matchers/simple_matcher_spec.rb +93 -0
- data/vendor/rspec/spec/spec/matchers/throw_symbol_spec.rb +96 -0
- data/vendor/rspec/spec/spec/mocks/and_yield_spec.rb +117 -0
- data/vendor/rspec/spec/spec/mocks/any_number_of_times_spec.rb +36 -0
- data/vendor/rspec/spec/spec/mocks/argument_expectation_spec.rb +23 -0
- data/vendor/rspec/spec/spec/mocks/argument_matchers_spec.rb +19 -0
- data/vendor/rspec/spec/spec/mocks/at_least_spec.rb +97 -0
- data/vendor/rspec/spec/spec/mocks/at_most_spec.rb +93 -0
- data/vendor/rspec/spec/spec/mocks/bug_report_10260_spec.rb +8 -0
- data/vendor/rspec/spec/spec/mocks/bug_report_10263_spec.rb +27 -0
- data/vendor/rspec/spec/spec/mocks/bug_report_11545_spec.rb +32 -0
- data/vendor/rspec/spec/spec/mocks/bug_report_15719_spec.rb +30 -0
- data/vendor/rspec/spec/spec/mocks/bug_report_496_spec.rb +19 -0
- data/vendor/rspec/spec/spec/mocks/bug_report_600_spec.rb +22 -0
- data/vendor/rspec/spec/spec/mocks/bug_report_7611_spec.rb +19 -0
- data/vendor/rspec/spec/spec/mocks/bug_report_7805_spec.rb +22 -0
- data/vendor/rspec/spec/spec/mocks/bug_report_8165_spec.rb +31 -0
- data/vendor/rspec/spec/spec/mocks/bug_report_8302_spec.rb +26 -0
- data/vendor/rspec/spec/spec/mocks/bug_report_830_spec.rb +21 -0
- data/vendor/rspec/spec/spec/mocks/double_spec.rb +12 -0
- data/vendor/rspec/spec/spec/mocks/failing_argument_matchers_spec.rb +95 -0
- data/vendor/rspec/spec/spec/mocks/hash_including_matcher_spec.rb +90 -0
- data/vendor/rspec/spec/spec/mocks/hash_not_including_matcher_spec.rb +67 -0
- data/vendor/rspec/spec/spec/mocks/mock_ordering_spec.rb +94 -0
- data/vendor/rspec/spec/spec/mocks/mock_space_spec.rb +54 -0
- data/vendor/rspec/spec/spec/mocks/mock_spec.rb +594 -0
- data/vendor/rspec/spec/spec/mocks/multiple_return_value_spec.rb +113 -0
- data/vendor/rspec/spec/spec/mocks/nil_expectation_warning_spec.rb +53 -0
- data/vendor/rspec/spec/spec/mocks/null_object_mock_spec.rb +54 -0
- data/vendor/rspec/spec/spec/mocks/once_counts_spec.rb +53 -0
- data/vendor/rspec/spec/spec/mocks/options_hash_spec.rb +35 -0
- data/vendor/rspec/spec/spec/mocks/partial_mock_spec.rb +164 -0
- data/vendor/rspec/spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb +66 -0
- data/vendor/rspec/spec/spec/mocks/passing_argument_matchers_spec.rb +145 -0
- data/vendor/rspec/spec/spec/mocks/precise_counts_spec.rb +52 -0
- data/vendor/rspec/spec/spec/mocks/record_messages_spec.rb +26 -0
- data/vendor/rspec/spec/spec/mocks/stub_chain_spec.rb +42 -0
- data/vendor/rspec/spec/spec/mocks/stub_implementation_spec.rb +31 -0
- data/vendor/rspec/spec/spec/mocks/stub_spec.rb +203 -0
- data/vendor/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb +26 -0
- data/vendor/rspec/spec/spec/mocks/twice_counts_spec.rb +67 -0
- data/vendor/rspec/spec/spec/mocks/unstub_spec.rb +127 -0
- data/vendor/rspec/spec/spec/package/bin_spec_spec.rb +16 -0
- data/vendor/rspec/spec/spec/rake/spectask_spec.rb +150 -0
- data/vendor/rspec/spec/spec/runner/class_and_argument_parser_spec.rb +23 -0
- data/vendor/rspec/spec/spec/runner/command_line_spec.rb +141 -0
- data/vendor/rspec/spec/spec/runner/configuration_spec.rb +320 -0
- data/vendor/rspec/spec/spec/runner/drb_command_line_spec.rb +107 -0
- data/vendor/rspec/spec/spec/runner/empty_file.txt +0 -0
- data/vendor/rspec/spec/spec/runner/example_group_runner_spec.rb +26 -0
- data/vendor/rspec/spec/spec/runner/examples.txt +2 -0
- data/vendor/rspec/spec/spec/runner/failed.txt +3 -0
- data/vendor/rspec/spec/spec/runner/formatter/base_formatter_spec.rb +30 -0
- data/vendor/rspec/spec/spec/runner/formatter/base_text_formatter_spec.rb +113 -0
- data/vendor/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +45 -0
- data/vendor/rspec/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +33 -0
- data/vendor/rspec/spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html +377 -0
- data/vendor/rspec/spec/spec/runner/formatter/html_formatted-1.8.6.html +377 -0
- data/vendor/rspec/spec/spec/runner/formatter/html_formatted-1.8.7.html +377 -0
- data/vendor/rspec/spec/spec/runner/formatter/html_formatted-1.9.1.html +377 -0
- data/vendor/rspec/spec/spec/runner/formatter/html_formatter_spec.rb +118 -0
- data/vendor/rspec/spec/spec/runner/formatter/nested_text_formatter_spec.rb +305 -0
- data/vendor/rspec/spec/spec/runner/formatter/profile_formatter_spec.rb +70 -0
- data/vendor/rspec/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +149 -0
- data/vendor/rspec/spec/spec/runner/formatter/snippet_extractor_spec.rb +18 -0
- data/vendor/rspec/spec/spec/runner/formatter/specdoc_formatter_spec.rb +159 -0
- data/vendor/rspec/spec/spec/runner/formatter/text_mate_formatted-1.8.6-jruby.html +371 -0
- data/vendor/rspec/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +371 -0
- data/vendor/rspec/spec/spec/runner/formatter/text_mate_formatted-1.8.7.html +371 -0
- data/vendor/rspec/spec/spec/runner/formatter/text_mate_formatted-1.9.1.html +371 -0
- data/vendor/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb +106 -0
- data/vendor/rspec/spec/spec/runner/heckle_runner_spec.rb +78 -0
- data/vendor/rspec/spec/spec/runner/heckler_spec.rb +20 -0
- data/vendor/rspec/spec/spec/runner/line_number_query/line_number_query_fixture.rb +70 -0
- data/vendor/rspec/spec/spec/runner/line_number_query_spec.rb +129 -0
- data/vendor/rspec/spec/spec/runner/noisy_backtrace_tweaker_spec.rb +51 -0
- data/vendor/rspec/spec/spec/runner/option_parser_spec.rb +545 -0
- data/vendor/rspec/spec/spec/runner/options_spec.rb +547 -0
- data/vendor/rspec/spec/spec/runner/output_one_time_fixture.rb +7 -0
- data/vendor/rspec/spec/spec/runner/output_one_time_fixture_runner.rb +7 -0
- data/vendor/rspec/spec/spec/runner/output_one_time_spec.rb +15 -0
- data/vendor/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +123 -0
- data/vendor/rspec/spec/spec/runner/reporter_spec.rb +244 -0
- data/vendor/rspec/spec/spec/runner/resources/a_bar.rb +0 -0
- data/vendor/rspec/spec/spec/runner/resources/a_foo.rb +0 -0
- data/vendor/rspec/spec/spec/runner/resources/a_spec.rb +1 -0
- data/vendor/rspec/spec/spec/runner/resources/custom_example_group_runner.rb +14 -0
- data/vendor/rspec/spec/spec/runner/resources/utf8_encoded.rb +8 -0
- data/vendor/rspec/spec/spec/runner/spec.opts +2 -0
- data/vendor/rspec/spec/spec/runner/spec_drb.opts +2 -0
- data/vendor/rspec/spec/spec/runner/spec_spaced.opts +2 -0
- data/vendor/rspec/spec/spec/runner_spec.rb +13 -0
- data/vendor/rspec/spec/spec.opts +6 -0
- data/vendor/rspec/spec/spec_helper.rb +112 -0
- data/vendor/rspec/spec/support/macros.rb +29 -0
- data/vendor/rspec/spec/support/spec_classes.rb +133 -0
- data/vendor/rubyexts/CHANGELOG +2 -0
- data/vendor/rubyexts/LICENSE +20 -0
- data/vendor/rubyexts/README.textile +0 -0
- data/vendor/rubyexts/Rakefile +62 -0
- data/vendor/rubyexts/TODO.txt +6 -0
- data/vendor/rubyexts/lib/rubyexts/array.rb +20 -0
- data/vendor/rubyexts/lib/rubyexts/attribute.rb +150 -0
- data/vendor/rubyexts/lib/rubyexts/capture_io.rb +32 -0
- data/vendor/rubyexts/lib/rubyexts/class.rb +177 -0
- data/vendor/rubyexts/lib/rubyexts/colored_string.rb +103 -0
- data/vendor/rubyexts/lib/rubyexts/enumerable.rb +30 -0
- data/vendor/rubyexts/lib/rubyexts/file.rb +84 -0
- data/vendor/rubyexts/lib/rubyexts/hash.rb +147 -0
- data/vendor/rubyexts/lib/rubyexts/kernel.rb +91 -0
- data/vendor/rubyexts/lib/rubyexts/module.rb +53 -0
- data/vendor/rubyexts/lib/rubyexts/object.rb +56 -0
- data/vendor/rubyexts/lib/rubyexts/object_space.rb +16 -0
- data/vendor/rubyexts/lib/rubyexts/os.rb +89 -0
- data/vendor/rubyexts/lib/rubyexts/platform.rb +27 -0
- data/vendor/rubyexts/lib/rubyexts/random.rb +25 -0
- data/vendor/rubyexts/lib/rubyexts/string.rb +92 -0
- data/vendor/rubyexts/lib/rubyexts/time.rb +15 -0
- data/vendor/rubyexts/lib/rubyexts/time_dsl.rb +62 -0
- data/vendor/rubyexts/lib/rubyexts/unique_array.rb +16 -0
- data/vendor/rubyexts/lib/rubyexts.rb +102 -0
- data/vendor/rubyexts/rubyexts.gemspec +36 -0
- data/vendor/rubyexts/script/spec +12 -0
- data/vendor/rubyexts/spec/rubyexts/array_spec.rb +19 -0
- data/vendor/rubyexts/spec/rubyexts/attribute_spec.rb +37 -0
- data/vendor/rubyexts/spec/rubyexts/class_spec.rb +1 -0
- data/vendor/rubyexts/spec/rubyexts/cli_spec.rb +0 -0
- data/vendor/rubyexts/spec/rubyexts/colored_string_spec.rb +9 -0
- data/vendor/rubyexts/spec/rubyexts/enumerable_spec.rb +52 -0
- data/vendor/rubyexts/spec/rubyexts/file_spec.rb +78 -0
- data/vendor/rubyexts/spec/rubyexts/hash_spec.rb +91 -0
- data/vendor/rubyexts/spec/rubyexts/kernel_spec.rb +9 -0
- data/vendor/rubyexts/spec/rubyexts/module_spec.rb +0 -0
- data/vendor/rubyexts/spec/rubyexts/object_space_spec.rb +17 -0
- data/vendor/rubyexts/spec/rubyexts/object_spec.rb +57 -0
- data/vendor/rubyexts/spec/rubyexts/os_spec.rb +121 -0
- data/vendor/rubyexts/spec/rubyexts/platform_spec.rb +0 -0
- data/vendor/rubyexts/spec/rubyexts/random_spec.rb +31 -0
- data/vendor/rubyexts/spec/rubyexts/string_spec.rb +23 -0
- data/vendor/rubyexts/spec/rubyexts/time_dsl_spec.rb +88 -0
- data/vendor/rubyexts/spec/rubyexts/time_spec.rb +11 -0
- data/vendor/rubyexts/spec/rubyexts/unique_array_spec.rb +0 -0
- data/vendor/rubyexts/spec/rubyexts_spec.rb +182 -0
- data/vendor/rubyexts/spec/spec.opts +5 -0
- data/vendor/rubyexts/spec/spec_helper.rb +16 -0
- metadata +955 -0
|
@@ -0,0 +1,1334 @@
|
|
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
|
2
|
+
require 'fakefs'
|
|
3
|
+
require 'test/unit'
|
|
4
|
+
|
|
5
|
+
class FakeFSTest < Test::Unit::TestCase
|
|
6
|
+
include FakeFS
|
|
7
|
+
|
|
8
|
+
def setup
|
|
9
|
+
FileSystem.clear
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_can_be_initialized_empty
|
|
13
|
+
fs = FileSystem
|
|
14
|
+
assert_equal 0, fs.files.size
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def xtest_can_be_initialized_with_an_existing_directory
|
|
18
|
+
fs = FileSystem
|
|
19
|
+
fs.clone(File.expand_path(File.dirname(__FILE__))).inspect
|
|
20
|
+
assert_equal 1, fs.files.size
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_can_create_directories
|
|
24
|
+
FileUtils.mkdir_p("/path/to/dir")
|
|
25
|
+
assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir']
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_can_create_directories_with_mkpath
|
|
29
|
+
FileUtils.mkpath("/path/to/dir")
|
|
30
|
+
assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir']
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_can_delete_directories
|
|
34
|
+
FileUtils.mkdir_p("/path/to/dir")
|
|
35
|
+
FileUtils.rmdir("/path/to/dir")
|
|
36
|
+
assert File.exists?("/path/to/")
|
|
37
|
+
assert File.exists?("/path/to/dir") == false
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test_knows_directories_exist
|
|
41
|
+
FileUtils.mkdir_p(path = "/path/to/dir")
|
|
42
|
+
assert File.exists?(path)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_knows_directories_are_directories
|
|
46
|
+
FileUtils.mkdir_p(path = "/path/to/dir")
|
|
47
|
+
assert File.directory?(path)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def test_knows_symlink_directories_are_directories
|
|
51
|
+
FileUtils.mkdir_p(path = "/path/to/dir")
|
|
52
|
+
FileUtils.ln_s path, sympath = '/sympath'
|
|
53
|
+
assert File.directory?(sympath)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_knows_non_existent_directories_arent_directories
|
|
57
|
+
path = 'does/not/exist/'
|
|
58
|
+
assert_equal RealFile.directory?(path), File.directory?(path)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def test_doesnt_overwrite_existing_directories
|
|
62
|
+
FileUtils.mkdir_p(path = "/path/to/dir")
|
|
63
|
+
assert File.exists?(path)
|
|
64
|
+
FileUtils.mkdir_p("/path/to")
|
|
65
|
+
assert File.exists?(path)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def test_can_create_symlinks
|
|
69
|
+
FileUtils.mkdir_p(target = "/path/to/target")
|
|
70
|
+
FileUtils.ln_s(target, "/path/to/link")
|
|
71
|
+
assert_kind_of FakeSymlink, FileSystem.fs['path']['to']['link']
|
|
72
|
+
|
|
73
|
+
assert_raises(Errno::EEXIST) do
|
|
74
|
+
FileUtils.ln_s(target, '/path/to/link')
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def test_can_force_creation_of_symlinks
|
|
79
|
+
FileUtils.mkdir_p(target = "/path/to/first/target")
|
|
80
|
+
FileUtils.ln_s(target, "/path/to/link")
|
|
81
|
+
assert_kind_of FakeSymlink, FileSystem.fs['path']['to']['link']
|
|
82
|
+
FileUtils.ln_s(target, '/path/to/link', :force => true)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def test_create_symlink_using_ln_sf
|
|
86
|
+
FileUtils.mkdir_p(target = "/path/to/first/target")
|
|
87
|
+
FileUtils.ln_s(target, "/path/to/link")
|
|
88
|
+
assert_kind_of FakeSymlink, FileSystem.fs['path']['to']['link']
|
|
89
|
+
FileUtils.ln_sf(target, '/path/to/link')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def test_can_follow_symlinks
|
|
93
|
+
FileUtils.mkdir_p(target = "/path/to/target")
|
|
94
|
+
FileUtils.ln_s(target, link = "/path/to/symlink")
|
|
95
|
+
assert_equal target, File.readlink(link)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def test_knows_symlinks_are_symlinks
|
|
99
|
+
FileUtils.mkdir_p(target = "/path/to/target")
|
|
100
|
+
FileUtils.ln_s(target, link = "/path/to/symlink")
|
|
101
|
+
assert File.symlink?(link)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def test_can_create_files
|
|
105
|
+
path = '/path/to/file.txt'
|
|
106
|
+
File.open(path, 'w') do |f|
|
|
107
|
+
f.write "Yatta!"
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
assert File.exists?(path)
|
|
111
|
+
assert File.readable?(path)
|
|
112
|
+
assert File.writable?(path)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def test_can_create_files_with_bitmasks
|
|
116
|
+
path = '/path/to/file.txt'
|
|
117
|
+
File.open(path, File::RDWR | File::CREAT) do |f|
|
|
118
|
+
f.write "Yatta!"
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
assert File.exists?(path)
|
|
122
|
+
assert File.readable?(path)
|
|
123
|
+
assert File.writable?(path)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def test_file_opens_in_read_only_mode
|
|
127
|
+
File.open("foo", "w") { |f| f << "foo" }
|
|
128
|
+
|
|
129
|
+
f = File.open("foo")
|
|
130
|
+
|
|
131
|
+
assert_raises(IOError) do
|
|
132
|
+
f << "bar"
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def test_file_opens_in_read_only_mode_with_bitmasks
|
|
137
|
+
File.open("foo", "w") { |f| f << "foo" }
|
|
138
|
+
|
|
139
|
+
f = File.open("foo", File::RDONLY)
|
|
140
|
+
|
|
141
|
+
assert_raises(IOError) do
|
|
142
|
+
f << "bar"
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def test_file_opens_in_invalid_mode
|
|
147
|
+
FileUtils.touch("foo")
|
|
148
|
+
|
|
149
|
+
assert_raises(ArgumentError) do
|
|
150
|
+
File.open("foo", "an_illegal_mode")
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def test_raises_error_when_cannot_find_file_in_read_mode
|
|
155
|
+
assert_raises(Errno::ENOENT) do
|
|
156
|
+
File.open("does_not_exist", "r")
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def test_raises_error_when_cannot_find_file_in_read_write_mode
|
|
161
|
+
assert_raises(Errno::ENOENT) do
|
|
162
|
+
File.open("does_not_exist", "r+")
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def test_creates_files_in_write_only_mode
|
|
167
|
+
File.open("foo", "w")
|
|
168
|
+
assert File.exists?("foo")
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def test_creates_files_in_write_only_mode_with_bitmasks
|
|
172
|
+
File.open("foo", File::WRONLY | File::CREAT)
|
|
173
|
+
assert File.exists?("foo")
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def test_raises_in_write_only_mode_without_create_bitmask
|
|
177
|
+
assert_raises(Errno::ENOENT) do
|
|
178
|
+
File.open("foo", File::WRONLY)
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def test_creates_files_in_read_write_truncate_mode
|
|
183
|
+
File.open("foo", "w+")
|
|
184
|
+
assert File.exists?("foo")
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def test_creates_files_in_append_write_only
|
|
188
|
+
File.open("foo", "a")
|
|
189
|
+
assert File.exists?("foo")
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def test_creates_files_in_append_read_write
|
|
193
|
+
File.open("foo", "a+")
|
|
194
|
+
assert File.exists?("foo")
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def test_file_in_write_only_raises_error_when_reading
|
|
198
|
+
FileUtils.touch("foo")
|
|
199
|
+
|
|
200
|
+
f = File.open("foo", "w")
|
|
201
|
+
|
|
202
|
+
assert_raises(IOError) do
|
|
203
|
+
f.read
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def test_file_in_write_mode_truncates_existing_file
|
|
208
|
+
File.open("foo", "w") { |f| f << "contents" }
|
|
209
|
+
|
|
210
|
+
f = File.open("foo", "w")
|
|
211
|
+
|
|
212
|
+
assert_equal "", File.read("foo")
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def test_file_in_read_write_truncation_mode_truncates_file
|
|
216
|
+
File.open("foo", "w") { |f| f << "foo" }
|
|
217
|
+
|
|
218
|
+
f = File.open("foo", "w+")
|
|
219
|
+
|
|
220
|
+
assert_equal "", File.read("foo")
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def test_file_in_append_write_only_raises_error_when_reading
|
|
224
|
+
FileUtils.touch("foo")
|
|
225
|
+
|
|
226
|
+
f = File.open("foo", "a")
|
|
227
|
+
|
|
228
|
+
assert_raises(IOError) do
|
|
229
|
+
f.read
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
def test_can_read_files_once_written
|
|
234
|
+
path = '/path/to/file.txt'
|
|
235
|
+
File.open(path, 'w') do |f|
|
|
236
|
+
f.write "Yatta!"
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
assert_equal "Yatta!", File.read(path)
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
def test_can_write_to_files
|
|
243
|
+
path = '/path/to/file.txt'
|
|
244
|
+
File.open(path, 'w') do |f|
|
|
245
|
+
f << 'Yada Yada'
|
|
246
|
+
end
|
|
247
|
+
assert_equal 'Yada Yada', File.read(path)
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
def test_raises_error_when_opening_with_binary_mode_only
|
|
251
|
+
assert_raise ArgumentError do
|
|
252
|
+
File.open("/foo", "b")
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
def test_can_open_file_in_binary_mode
|
|
257
|
+
File.open("/foo", "wb") { |x| x << "a" }
|
|
258
|
+
assert_equal "a", File.read("/foo")
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
def test_can_chunk_io_when_reading
|
|
262
|
+
path = '/path/to/file.txt'
|
|
263
|
+
File.open(path, 'w') do |f|
|
|
264
|
+
f << 'Yada Yada'
|
|
265
|
+
end
|
|
266
|
+
file = File.new(path, 'r')
|
|
267
|
+
assert_equal 'Yada', file.read(4)
|
|
268
|
+
assert_equal ' Yada', file.read(5)
|
|
269
|
+
assert_equal '', file.read
|
|
270
|
+
file.rewind
|
|
271
|
+
assert_equal 'Yada Yada', file.read
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def test_can_get_size_of_files
|
|
275
|
+
path = '/path/to/file.txt'
|
|
276
|
+
File.open(path, 'w') do |f|
|
|
277
|
+
f << 'Yada Yada'
|
|
278
|
+
end
|
|
279
|
+
assert_equal 9, File.size(path)
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
def test_can_check_if_file_has_size?
|
|
283
|
+
path = '/path/to/file.txt'
|
|
284
|
+
File.open(path, 'w') do |f|
|
|
285
|
+
f << 'Yada Yada'
|
|
286
|
+
end
|
|
287
|
+
assert File.size?(path)
|
|
288
|
+
assert_nil File.size?("/path/to/other.txt")
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
def test_can_check_size_of_empty_file
|
|
292
|
+
path = '/path/to/file.txt'
|
|
293
|
+
File.open(path, 'w') do |f|
|
|
294
|
+
f << ''
|
|
295
|
+
end
|
|
296
|
+
assert_nil File.size?("/path/to/file.txt")
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
def test_raises_error_on_mtime_if_file_does_not_exist
|
|
300
|
+
assert_raise Errno::ENOENT do
|
|
301
|
+
File.mtime('/path/to/file.txt')
|
|
302
|
+
end
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
def test_can_return_mtime_on_existing_file
|
|
306
|
+
path = '/path/to/file.txt'
|
|
307
|
+
File.open(path, 'w') do |f|
|
|
308
|
+
f << ''
|
|
309
|
+
end
|
|
310
|
+
assert File.mtime('/path/to/file.txt').is_a?(Time)
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
def test_can_read_with_File_readlines
|
|
314
|
+
path = '/path/to/file.txt'
|
|
315
|
+
File.open(path, 'w') do |f|
|
|
316
|
+
f.puts "Yatta!", "Gatta!"
|
|
317
|
+
f.puts ["woot","toot"]
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
assert_equal %w(Yatta! Gatta! woot toot), File.readlines(path)
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
def test_File_close_disallows_further_access
|
|
324
|
+
path = '/path/to/file.txt'
|
|
325
|
+
file = File.open(path, 'w')
|
|
326
|
+
file.write 'Yada'
|
|
327
|
+
file.close
|
|
328
|
+
assert_raise IOError do
|
|
329
|
+
file.read
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
def test_File_close_disallows_further_writes
|
|
334
|
+
path = '/path/to/file.txt'
|
|
335
|
+
file = File.open(path, 'w')
|
|
336
|
+
file.write 'Yada'
|
|
337
|
+
file.close
|
|
338
|
+
assert_raise IOError do
|
|
339
|
+
file << "foo"
|
|
340
|
+
end
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
def test_can_read_from_file_objects
|
|
344
|
+
path = '/path/to/file.txt'
|
|
345
|
+
File.open(path, 'w') do |f|
|
|
346
|
+
f.write "Yatta!"
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
assert_equal "Yatta!", File.new(path).read
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def test_file_read_errors_appropriately
|
|
353
|
+
assert_raise Errno::ENOENT do
|
|
354
|
+
File.read('anything')
|
|
355
|
+
end
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def test_knows_files_are_files
|
|
359
|
+
path = '/path/to/file.txt'
|
|
360
|
+
File.open(path, 'w') do |f|
|
|
361
|
+
f.write "Yatta!"
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
assert File.file?(path)
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
def test_File_io_returns_self
|
|
368
|
+
f = File.open("/foo", "w")
|
|
369
|
+
assert_equal f, f.to_io
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
def test_File_to_i_is_alias_for_filno
|
|
373
|
+
f = File.open("/foo", "w")
|
|
374
|
+
assert_equal f.method(:to_i), f.method(:fileno)
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
def test_knows_symlink_files_are_files
|
|
378
|
+
path = '/path/to/file.txt'
|
|
379
|
+
File.open(path, 'w') do |f|
|
|
380
|
+
f.write "Yatta!"
|
|
381
|
+
end
|
|
382
|
+
FileUtils.ln_s path, sympath='/sympath'
|
|
383
|
+
|
|
384
|
+
assert File.file?(sympath)
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
def test_knows_non_existent_files_arent_files
|
|
388
|
+
assert_equal RealFile.file?('does/not/exist.txt'), File.file?('does/not/exist.txt')
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
def test_can_chown_files
|
|
392
|
+
good = 'file.txt'
|
|
393
|
+
bad = 'nofile.txt'
|
|
394
|
+
File.open(good,'w') { |f| f.write "foo" }
|
|
395
|
+
|
|
396
|
+
out = FileUtils.chown('noone', 'nogroup', good, :verbose => true)
|
|
397
|
+
assert_equal [good], out
|
|
398
|
+
assert_raises(Errno::ENOENT) do
|
|
399
|
+
FileUtils.chown('noone', 'nogroup', bad, :verbose => true)
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
assert_equal [good], FileUtils.chown('noone', 'nogroup', good)
|
|
403
|
+
assert_raises(Errno::ENOENT) do
|
|
404
|
+
FileUtils.chown('noone', 'nogroup', bad)
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
assert_equal [good], FileUtils.chown('noone', 'nogroup', [good])
|
|
408
|
+
assert_raises(Errno::ENOENT) do
|
|
409
|
+
FileUtils.chown('noone', 'nogroup', [good, bad])
|
|
410
|
+
end
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
def test_can_chown_R_files
|
|
414
|
+
FileUtils.mkdir_p '/path/'
|
|
415
|
+
File.open('/path/foo', 'w') { |f| f.write 'foo' }
|
|
416
|
+
File.open('/path/foobar', 'w') { |f| f.write 'foo' }
|
|
417
|
+
resp = FileUtils.chown_R('no', 'no', '/path')
|
|
418
|
+
assert_equal ['/path'], resp
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
def test_dir_globs_paths
|
|
422
|
+
FileUtils.mkdir_p '/path'
|
|
423
|
+
File.open('/path/foo', 'w') { |f| f.write 'foo' }
|
|
424
|
+
File.open('/path/foobar', 'w') { |f| f.write 'foo' }
|
|
425
|
+
|
|
426
|
+
FileUtils.mkdir_p '/path/bar'
|
|
427
|
+
File.open('/path/bar/baz', 'w') { |f| f.write 'foo' }
|
|
428
|
+
|
|
429
|
+
FileUtils.cp_r '/path/bar', '/path/bar2'
|
|
430
|
+
|
|
431
|
+
assert_equal ['/path'], Dir['/path']
|
|
432
|
+
assert_equal %w( /path/bar /path/bar2 /path/foo /path/foobar ), Dir['/path/*']
|
|
433
|
+
|
|
434
|
+
assert_equal ['/path/bar/baz'], Dir['/path/bar/*']
|
|
435
|
+
assert_equal ['/path/foo'], Dir['/path/foo']
|
|
436
|
+
|
|
437
|
+
assert_equal ['/path'], Dir['/path*']
|
|
438
|
+
assert_equal ['/path/foo', '/path/foobar'], Dir['/p*h/foo*']
|
|
439
|
+
assert_equal ['/path/foo', '/path/foobar'], Dir['/p??h/foo*']
|
|
440
|
+
|
|
441
|
+
FileUtils.cp_r '/path', '/otherpath'
|
|
442
|
+
|
|
443
|
+
assert_equal %w( /otherpath/foo /otherpath/foobar /path/foo /path/foobar ), Dir['/*/foo*']
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
def test_dir_glob_handles_root
|
|
447
|
+
FileUtils.mkdir_p '/path'
|
|
448
|
+
|
|
449
|
+
# this fails. the root dir should be named '/' but it is '.'
|
|
450
|
+
#assert_equal ['/'], Dir['/']
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
def test_dir_glob_handles_recursive_globs
|
|
454
|
+
File.open('/one/two/three/four.rb', 'w')
|
|
455
|
+
File.open('/one/five.rb', 'w')
|
|
456
|
+
assert_equal ['/one/five.rb', '/one/two/three/four.rb'], Dir['/one/**/*.rb']
|
|
457
|
+
assert_equal ['/one/two'], Dir['/one/**/two']
|
|
458
|
+
assert_equal ['/one/two/three'], Dir['/one/**/three']
|
|
459
|
+
end
|
|
460
|
+
|
|
461
|
+
def test_dir_recursive_glob_ending_in_wildcards_only_returns_files
|
|
462
|
+
File.open('/one/two/three/four.rb', 'w')
|
|
463
|
+
File.open('/one/five.rb', 'w')
|
|
464
|
+
assert_equal ['/one/five.rb', '/one/two/three/four.rb'], Dir['/one/**/*']
|
|
465
|
+
assert_equal ['/one/five.rb', '/one/two/three/four.rb'], Dir['/one/**']
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
def test_should_report_pos_as_0_when_opening
|
|
469
|
+
File.open("/foo", "w") do |f|
|
|
470
|
+
f << "foobar"
|
|
471
|
+
f.rewind
|
|
472
|
+
|
|
473
|
+
assert_equal 0, f.pos
|
|
474
|
+
end
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
def test_should_report_pos_as_1_when_seeking_one_char
|
|
478
|
+
File.open("/foo", "w") do |f|
|
|
479
|
+
f << "foobar"
|
|
480
|
+
|
|
481
|
+
f.rewind
|
|
482
|
+
f.seek(1)
|
|
483
|
+
|
|
484
|
+
assert_equal 1, f.pos
|
|
485
|
+
end
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
def test_should_set_pos
|
|
489
|
+
File.open("/foo", "w") do |f|
|
|
490
|
+
f << "foo"
|
|
491
|
+
end
|
|
492
|
+
|
|
493
|
+
fp = File.open("/foo", "r")
|
|
494
|
+
fp.pos = 1
|
|
495
|
+
|
|
496
|
+
assert_equal 1, fp.pos
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
def test_should_set_pos_with_tell_method
|
|
500
|
+
File.open("/foo", "w") do |f|
|
|
501
|
+
f << "foo"
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
fp = File.open("/foo", "r")
|
|
505
|
+
fp.tell = 1
|
|
506
|
+
|
|
507
|
+
assert_equal 1, fp.pos
|
|
508
|
+
end
|
|
509
|
+
|
|
510
|
+
# Every method in File is in FakeFS::File
|
|
511
|
+
RealFile.instance_methods.each do |method_name|
|
|
512
|
+
define_method "test_should_have_method_#{method_name}_from_real_file_class" do
|
|
513
|
+
assert File.instance_methods.include?(method_name)
|
|
514
|
+
end
|
|
515
|
+
end
|
|
516
|
+
|
|
517
|
+
# No methods which are in StringIO that aren't in File are included into
|
|
518
|
+
# FakeFS::File (because of inheritence)
|
|
519
|
+
uniq_string_io_methods = StringIO.instance_methods - RealFile.instance_methods
|
|
520
|
+
uniq_string_io_methods.each do |method_name|
|
|
521
|
+
define_method "test_file_should_not_respond_to_#{method_name}" do
|
|
522
|
+
assert !File.instance_methods.include?(method_name)
|
|
523
|
+
end
|
|
524
|
+
end
|
|
525
|
+
|
|
526
|
+
def test_does_not_remove_methods_from_stringio
|
|
527
|
+
stringio = StringIO.new("foo")
|
|
528
|
+
assert stringio.respond_to?(:size)
|
|
529
|
+
end
|
|
530
|
+
|
|
531
|
+
def test_chdir_changes_directories_like_a_boss
|
|
532
|
+
# I know memes!
|
|
533
|
+
FileUtils.mkdir_p '/path'
|
|
534
|
+
assert_equal '.', FileSystem.fs.name
|
|
535
|
+
assert_equal({}, FileSystem.fs['path'])
|
|
536
|
+
Dir.chdir '/path' do
|
|
537
|
+
File.open('foo', 'w') { |f| f.write 'foo'}
|
|
538
|
+
File.open('foobar', 'w') { |f| f.write 'foo'}
|
|
539
|
+
end
|
|
540
|
+
|
|
541
|
+
assert_equal '.', FileSystem.fs.name
|
|
542
|
+
assert_equal(['foo', 'foobar'], FileSystem.fs['path'].keys.sort)
|
|
543
|
+
|
|
544
|
+
c = nil
|
|
545
|
+
Dir.chdir '/path' do
|
|
546
|
+
c = File.open('foo', 'r') { |f| f.read }
|
|
547
|
+
end
|
|
548
|
+
|
|
549
|
+
assert_equal 'foo', c
|
|
550
|
+
end
|
|
551
|
+
|
|
552
|
+
def test_chdir_shouldnt_keep_us_from_absolute_paths
|
|
553
|
+
FileUtils.mkdir_p '/path'
|
|
554
|
+
|
|
555
|
+
Dir.chdir '/path' do
|
|
556
|
+
File.open('foo', 'w') { |f| f.write 'foo'}
|
|
557
|
+
File.open('/foobar', 'w') { |f| f.write 'foo'}
|
|
558
|
+
end
|
|
559
|
+
assert_equal ['foo'], FileSystem.fs['path'].keys.sort
|
|
560
|
+
assert_equal ['foobar', 'path'], FileSystem.fs.keys.sort
|
|
561
|
+
|
|
562
|
+
Dir.chdir '/path' do
|
|
563
|
+
FileUtils.rm('foo')
|
|
564
|
+
FileUtils.rm('/foobar')
|
|
565
|
+
end
|
|
566
|
+
|
|
567
|
+
assert_equal [], FileSystem.fs['path'].keys.sort
|
|
568
|
+
assert_equal ['path'], FileSystem.fs.keys.sort
|
|
569
|
+
end
|
|
570
|
+
|
|
571
|
+
def test_chdir_should_be_nestable
|
|
572
|
+
FileUtils.mkdir_p '/path/me'
|
|
573
|
+
Dir.chdir '/path' do
|
|
574
|
+
File.open('foo', 'w') { |f| f.write 'foo'}
|
|
575
|
+
Dir.chdir 'me' do
|
|
576
|
+
File.open('foobar', 'w') { |f| f.write 'foo'}
|
|
577
|
+
end
|
|
578
|
+
end
|
|
579
|
+
|
|
580
|
+
assert_equal ['foo','me'], FileSystem.fs['path'].keys.sort
|
|
581
|
+
assert_equal ['foobar'], FileSystem.fs['path']['me'].keys.sort
|
|
582
|
+
end
|
|
583
|
+
|
|
584
|
+
def test_chdir_should_flop_over_and_die_if_the_dir_doesnt_exist
|
|
585
|
+
assert_raise(Errno::ENOENT) do
|
|
586
|
+
Dir.chdir('/nope') do
|
|
587
|
+
1
|
|
588
|
+
end
|
|
589
|
+
end
|
|
590
|
+
end
|
|
591
|
+
|
|
592
|
+
def test_chdir_shouldnt_lose_state_because_of_errors
|
|
593
|
+
FileUtils.mkdir_p '/path'
|
|
594
|
+
|
|
595
|
+
Dir.chdir '/path' do
|
|
596
|
+
File.open('foo', 'w') { |f| f.write 'foo'}
|
|
597
|
+
File.open('foobar', 'w') { |f| f.write 'foo'}
|
|
598
|
+
end
|
|
599
|
+
|
|
600
|
+
begin
|
|
601
|
+
Dir.chdir('/path') do
|
|
602
|
+
raise Exception
|
|
603
|
+
end
|
|
604
|
+
rescue Exception # hardcore
|
|
605
|
+
end
|
|
606
|
+
|
|
607
|
+
Dir.chdir('/path') do
|
|
608
|
+
begin
|
|
609
|
+
Dir.chdir('nope'){ }
|
|
610
|
+
rescue Errno::ENOENT
|
|
611
|
+
end
|
|
612
|
+
|
|
613
|
+
assert_equal ['/path'], FileSystem.dir_levels
|
|
614
|
+
end
|
|
615
|
+
|
|
616
|
+
assert_equal(['foo', 'foobar'], FileSystem.fs['path'].keys.sort)
|
|
617
|
+
end
|
|
618
|
+
|
|
619
|
+
def test_chdir_with_no_block_is_awesome
|
|
620
|
+
FileUtils.mkdir_p '/path'
|
|
621
|
+
Dir.chdir('/path')
|
|
622
|
+
FileUtils.mkdir_p 'subdir'
|
|
623
|
+
assert_equal ['subdir'], FileSystem.current_dir.keys
|
|
624
|
+
Dir.chdir('subdir')
|
|
625
|
+
File.open('foo', 'w') { |f| f.write 'foo'}
|
|
626
|
+
assert_equal ['foo'], FileSystem.current_dir.keys
|
|
627
|
+
|
|
628
|
+
assert_raises(Errno::ENOENT) do
|
|
629
|
+
Dir.chdir('subsubdir')
|
|
630
|
+
end
|
|
631
|
+
|
|
632
|
+
assert_equal ['foo'], FileSystem.current_dir.keys
|
|
633
|
+
end
|
|
634
|
+
|
|
635
|
+
def test_current_dir_reflected_by_pwd
|
|
636
|
+
FileUtils.mkdir_p '/path'
|
|
637
|
+
Dir.chdir('/path')
|
|
638
|
+
|
|
639
|
+
assert_equal '/path', Dir.pwd
|
|
640
|
+
assert_equal '/path', Dir.getwd
|
|
641
|
+
|
|
642
|
+
FileUtils.mkdir_p 'subdir'
|
|
643
|
+
Dir.chdir('subdir')
|
|
644
|
+
|
|
645
|
+
assert_equal '/path/subdir', Dir.pwd
|
|
646
|
+
assert_equal '/path/subdir', Dir.getwd
|
|
647
|
+
end
|
|
648
|
+
|
|
649
|
+
def test_file_open_defaults_to_read
|
|
650
|
+
File.open('foo','w') { |f| f.write 'bar' }
|
|
651
|
+
assert_equal 'bar', File.open('foo') { |f| f.read }
|
|
652
|
+
end
|
|
653
|
+
|
|
654
|
+
def test_flush_exists_on_file
|
|
655
|
+
r = File.open('foo','w') { |f| f.write 'bar'; f.flush }
|
|
656
|
+
assert_equal 'foo', r.path
|
|
657
|
+
end
|
|
658
|
+
|
|
659
|
+
def test_mv_should_raise_error_on_missing_file
|
|
660
|
+
assert_raise(Errno::ENOENT) do
|
|
661
|
+
FileUtils.mv 'blafgag', 'foo'
|
|
662
|
+
end
|
|
663
|
+
end
|
|
664
|
+
|
|
665
|
+
def test_mv_actually_works
|
|
666
|
+
File.open('foo', 'w') { |f| f.write 'bar' }
|
|
667
|
+
FileUtils.mv 'foo', 'baz'
|
|
668
|
+
assert_equal 'bar', File.open('baz') { |f| f.read }
|
|
669
|
+
end
|
|
670
|
+
|
|
671
|
+
def test_cp_actually_works
|
|
672
|
+
File.open('foo', 'w') {|f| f.write 'bar' }
|
|
673
|
+
FileUtils.cp('foo', 'baz')
|
|
674
|
+
assert_equal 'bar', File.read('baz')
|
|
675
|
+
end
|
|
676
|
+
|
|
677
|
+
def test_cp_file_into_dir
|
|
678
|
+
File.open('foo', 'w') {|f| f.write 'bar' }
|
|
679
|
+
FileUtils.mkdir_p 'baz'
|
|
680
|
+
|
|
681
|
+
FileUtils.cp('foo', 'baz')
|
|
682
|
+
assert_equal 'bar', File.read('baz/foo')
|
|
683
|
+
end
|
|
684
|
+
|
|
685
|
+
def test_cp_overwrites_dest_file
|
|
686
|
+
File.open('foo', 'w') {|f| f.write 'FOO' }
|
|
687
|
+
File.open('bar', 'w') {|f| f.write 'BAR' }
|
|
688
|
+
|
|
689
|
+
FileUtils.cp('foo', 'bar')
|
|
690
|
+
assert_equal 'FOO', File.read('bar')
|
|
691
|
+
end
|
|
692
|
+
|
|
693
|
+
def test_cp_fails_on_no_source
|
|
694
|
+
assert_raise Errno::ENOENT do
|
|
695
|
+
FileUtils.cp('foo', 'baz')
|
|
696
|
+
end
|
|
697
|
+
end
|
|
698
|
+
|
|
699
|
+
def test_cp_fails_on_directory_copy
|
|
700
|
+
FileUtils.mkdir_p 'baz'
|
|
701
|
+
|
|
702
|
+
assert_raise Errno::EISDIR do
|
|
703
|
+
FileUtils.cp('baz', 'bar')
|
|
704
|
+
end
|
|
705
|
+
end
|
|
706
|
+
|
|
707
|
+
def test_cp_r_doesnt_tangle_files_together
|
|
708
|
+
File.open('foo', 'w') { |f| f.write 'bar' }
|
|
709
|
+
FileUtils.cp_r('foo', 'baz')
|
|
710
|
+
File.open('baz', 'w') { |f| f.write 'quux' }
|
|
711
|
+
assert_equal 'bar', File.open('foo') { |f| f.read }
|
|
712
|
+
end
|
|
713
|
+
|
|
714
|
+
def test_cp_r_should_raise_error_on_missing_file
|
|
715
|
+
# Yes, this error sucks, but it conforms to the original Ruby
|
|
716
|
+
# method.
|
|
717
|
+
assert_raise(RuntimeError) do
|
|
718
|
+
FileUtils.cp_r 'blafgag', 'foo'
|
|
719
|
+
end
|
|
720
|
+
end
|
|
721
|
+
|
|
722
|
+
def test_cp_r_handles_copying_directories
|
|
723
|
+
FileUtils.mkdir_p 'subdir'
|
|
724
|
+
Dir.chdir('subdir'){ File.open('foo', 'w') { |f| f.write 'footext' } }
|
|
725
|
+
|
|
726
|
+
FileUtils.mkdir_p 'baz'
|
|
727
|
+
|
|
728
|
+
# To a previously uncreated directory
|
|
729
|
+
FileUtils.cp_r('subdir', 'quux')
|
|
730
|
+
assert_equal 'footext', File.open('quux/foo') { |f| f.read }
|
|
731
|
+
|
|
732
|
+
# To a directory that already exists
|
|
733
|
+
FileUtils.cp_r('subdir', 'baz')
|
|
734
|
+
assert_equal 'footext', File.open('baz/subdir/foo') { |f| f.read }
|
|
735
|
+
|
|
736
|
+
# To a subdirectory of a directory that does not exist
|
|
737
|
+
assert_raises(Errno::ENOENT) do
|
|
738
|
+
FileUtils.cp_r('subdir', 'nope/something')
|
|
739
|
+
end
|
|
740
|
+
end
|
|
741
|
+
|
|
742
|
+
def test_cp_r_only_copies_into_directories
|
|
743
|
+
FileUtils.mkdir_p 'subdir'
|
|
744
|
+
Dir.chdir('subdir') { File.open('foo', 'w') { |f| f.write 'footext' } }
|
|
745
|
+
|
|
746
|
+
File.open('bar', 'w') { |f| f.write 'bartext' }
|
|
747
|
+
|
|
748
|
+
assert_raises(Errno::EEXIST) do
|
|
749
|
+
FileUtils.cp_r 'subdir', 'bar'
|
|
750
|
+
end
|
|
751
|
+
|
|
752
|
+
FileUtils.mkdir_p 'otherdir'
|
|
753
|
+
FileUtils.ln_s 'otherdir', 'symdir'
|
|
754
|
+
|
|
755
|
+
FileUtils.cp_r 'subdir', 'symdir'
|
|
756
|
+
assert_equal 'footext', File.open('symdir/subdir/foo') { |f| f.read }
|
|
757
|
+
end
|
|
758
|
+
|
|
759
|
+
def test_cp_r_sets_parent_correctly
|
|
760
|
+
FileUtils.mkdir_p '/path/foo'
|
|
761
|
+
File.open('/path/foo/bar', 'w') { |f| f.write 'foo' }
|
|
762
|
+
File.open('/path/foo/baz', 'w') { |f| f.write 'foo' }
|
|
763
|
+
|
|
764
|
+
FileUtils.cp_r '/path/foo', '/path/bar'
|
|
765
|
+
|
|
766
|
+
assert File.exists?('/path/bar/baz')
|
|
767
|
+
FileUtils.rm_rf '/path/bar/baz'
|
|
768
|
+
assert_equal %w( /path/bar/bar ), Dir['/path/bar/*']
|
|
769
|
+
end
|
|
770
|
+
|
|
771
|
+
def test_clone_clones_normal_files
|
|
772
|
+
RealFile.open(here('foo'), 'w') { |f| f.write 'bar' }
|
|
773
|
+
assert !File.exists?(here('foo'))
|
|
774
|
+
FileSystem.clone(here('foo'))
|
|
775
|
+
assert_equal 'bar', File.open(here('foo')) { |f| f.read }
|
|
776
|
+
ensure
|
|
777
|
+
RealFile.unlink(here('foo')) if RealFile.exists?(here('foo'))
|
|
778
|
+
end
|
|
779
|
+
|
|
780
|
+
def test_clone_clones_directories
|
|
781
|
+
RealFileUtils.mkdir_p(here('subdir'))
|
|
782
|
+
|
|
783
|
+
FileSystem.clone(here('subdir'))
|
|
784
|
+
|
|
785
|
+
assert File.exists?(here('subdir')), 'subdir was cloned'
|
|
786
|
+
assert File.directory?(here('subdir')), 'subdir is a directory'
|
|
787
|
+
ensure
|
|
788
|
+
RealFileUtils.rm_rf(here('subdir')) if RealFile.exists?(here('subdir'))
|
|
789
|
+
end
|
|
790
|
+
|
|
791
|
+
def test_clone_clones_dot_files_even_hard_to_find_ones
|
|
792
|
+
RealFileUtils.mkdir_p(here('subdir/.bar/baz/.quux/foo'))
|
|
793
|
+
assert !File.exists?(here('subdir'))
|
|
794
|
+
|
|
795
|
+
FileSystem.clone(here('subdir'))
|
|
796
|
+
assert_equal ['.bar'], FileSystem.find(here('subdir')).keys
|
|
797
|
+
assert_equal ['foo'], FileSystem.find(here('subdir/.bar/baz/.quux')).keys
|
|
798
|
+
ensure
|
|
799
|
+
RealFileUtils.rm_rf(here('subdir')) if RealFile.exists?(here('subdir'))
|
|
800
|
+
end
|
|
801
|
+
|
|
802
|
+
def test_putting_a_dot_at_end_copies_the_contents
|
|
803
|
+
FileUtils.mkdir_p 'subdir'
|
|
804
|
+
Dir.chdir('subdir') { File.open('foo', 'w') { |f| f.write 'footext' } }
|
|
805
|
+
|
|
806
|
+
FileUtils.mkdir_p 'newdir'
|
|
807
|
+
FileUtils.cp_r 'subdir/.', 'newdir'
|
|
808
|
+
assert_equal 'footext', File.open('newdir/foo') { |f| f.read }
|
|
809
|
+
end
|
|
810
|
+
|
|
811
|
+
def test_file_can_read_from_symlinks
|
|
812
|
+
File.open('first', 'w') { |f| f.write '1'}
|
|
813
|
+
FileUtils.ln_s 'first', 'one'
|
|
814
|
+
assert_equal '1', File.open('one') { |f| f.read }
|
|
815
|
+
|
|
816
|
+
FileUtils.mkdir_p 'subdir'
|
|
817
|
+
File.open('subdir/nother','w') { |f| f.write 'works' }
|
|
818
|
+
FileUtils.ln_s 'subdir', 'new'
|
|
819
|
+
assert_equal 'works', File.open('new/nother') { |f| f.read }
|
|
820
|
+
end
|
|
821
|
+
|
|
822
|
+
def test_can_symlink_through_file
|
|
823
|
+
FileUtils.touch("/foo")
|
|
824
|
+
|
|
825
|
+
File.symlink("/foo", "/bar")
|
|
826
|
+
|
|
827
|
+
assert File.symlink?("/bar")
|
|
828
|
+
end
|
|
829
|
+
|
|
830
|
+
def test_files_can_be_touched
|
|
831
|
+
FileUtils.touch('touched_file')
|
|
832
|
+
assert File.exists?('touched_file')
|
|
833
|
+
list = ['newfile', 'another']
|
|
834
|
+
FileUtils.touch(list)
|
|
835
|
+
list.each { |fp| assert(File.exists?(fp)) }
|
|
836
|
+
end
|
|
837
|
+
|
|
838
|
+
def test_touch_does_not_work_if_the_dir_path_cannot_be_found
|
|
839
|
+
assert_raises(Errno::ENOENT) do
|
|
840
|
+
FileUtils.touch('this/path/should/not/be/here')
|
|
841
|
+
end
|
|
842
|
+
FileUtils.mkdir_p('subdir')
|
|
843
|
+
list = ['subdir/foo', 'nosubdir/bar']
|
|
844
|
+
|
|
845
|
+
assert_raises(Errno::ENOENT) do
|
|
846
|
+
FileUtils.touch(list)
|
|
847
|
+
end
|
|
848
|
+
end
|
|
849
|
+
|
|
850
|
+
def test_extname
|
|
851
|
+
assert File.extname("test.doc") == ".doc"
|
|
852
|
+
end
|
|
853
|
+
|
|
854
|
+
# Directory tests
|
|
855
|
+
def test_new_directory
|
|
856
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
857
|
+
|
|
858
|
+
assert_nothing_raised do
|
|
859
|
+
Dir.new('/this/path/should/be/here')
|
|
860
|
+
end
|
|
861
|
+
end
|
|
862
|
+
|
|
863
|
+
def test_new_directory_does_not_work_if_dir_path_cannot_be_found
|
|
864
|
+
assert_raises(Errno::ENOENT) do
|
|
865
|
+
Dir.new('/this/path/should/not/be/here')
|
|
866
|
+
end
|
|
867
|
+
end
|
|
868
|
+
|
|
869
|
+
def test_directory_close
|
|
870
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
871
|
+
dir = Dir.new('/this/path/should/be/here')
|
|
872
|
+
assert dir.close.nil?
|
|
873
|
+
|
|
874
|
+
assert_raises(IOError) do
|
|
875
|
+
dir.each { |dir| dir }
|
|
876
|
+
end
|
|
877
|
+
end
|
|
878
|
+
|
|
879
|
+
def test_directory_each
|
|
880
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
881
|
+
|
|
882
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
883
|
+
|
|
884
|
+
test.each do |f|
|
|
885
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
886
|
+
end
|
|
887
|
+
|
|
888
|
+
dir = Dir.new('/this/path/should/be/here')
|
|
889
|
+
|
|
890
|
+
yielded = []
|
|
891
|
+
dir.each do |dir|
|
|
892
|
+
yielded << dir
|
|
893
|
+
end
|
|
894
|
+
|
|
895
|
+
assert yielded.size == test.size
|
|
896
|
+
test.each { |t| assert yielded.include?(t) }
|
|
897
|
+
end
|
|
898
|
+
|
|
899
|
+
def test_directory_path
|
|
900
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
901
|
+
good_path = '/this/path/should/be/here'
|
|
902
|
+
assert_equal good_path, Dir.new('/this/path/should/be/here').path
|
|
903
|
+
end
|
|
904
|
+
|
|
905
|
+
def test_directory_pos
|
|
906
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
907
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
908
|
+
test.each do |f|
|
|
909
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
910
|
+
end
|
|
911
|
+
|
|
912
|
+
dir = Dir.new('/this/path/should/be/here')
|
|
913
|
+
|
|
914
|
+
assert dir.pos == 0
|
|
915
|
+
dir.read
|
|
916
|
+
assert dir.pos == 1
|
|
917
|
+
dir.read
|
|
918
|
+
assert dir.pos == 2
|
|
919
|
+
dir.read
|
|
920
|
+
assert dir.pos == 3
|
|
921
|
+
dir.read
|
|
922
|
+
assert dir.pos == 4
|
|
923
|
+
dir.read
|
|
924
|
+
assert dir.pos == 5
|
|
925
|
+
end
|
|
926
|
+
|
|
927
|
+
def test_directory_pos_assign
|
|
928
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
929
|
+
|
|
930
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
931
|
+
test.each do |f|
|
|
932
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
933
|
+
end
|
|
934
|
+
|
|
935
|
+
dir = Dir.new('/this/path/should/be/here')
|
|
936
|
+
|
|
937
|
+
assert dir.pos == 0
|
|
938
|
+
dir.pos = 2
|
|
939
|
+
assert dir.pos == 2
|
|
940
|
+
end
|
|
941
|
+
|
|
942
|
+
def test_directory_read
|
|
943
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
944
|
+
|
|
945
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
946
|
+
test.each do |f|
|
|
947
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
948
|
+
end
|
|
949
|
+
|
|
950
|
+
dir = Dir.new('/this/path/should/be/here')
|
|
951
|
+
|
|
952
|
+
assert dir.pos == 0
|
|
953
|
+
d = dir.read
|
|
954
|
+
assert dir.pos == 1
|
|
955
|
+
assert d == '.'
|
|
956
|
+
|
|
957
|
+
d = dir.read
|
|
958
|
+
assert dir.pos == 2
|
|
959
|
+
assert d == '..'
|
|
960
|
+
end
|
|
961
|
+
|
|
962
|
+
def test_directory_read_past_length
|
|
963
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
964
|
+
|
|
965
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
966
|
+
test.each do |f|
|
|
967
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
968
|
+
end
|
|
969
|
+
|
|
970
|
+
dir = Dir.new('/this/path/should/be/here')
|
|
971
|
+
|
|
972
|
+
d = dir.read
|
|
973
|
+
assert_not_nil d
|
|
974
|
+
d = dir.read
|
|
975
|
+
assert_not_nil d
|
|
976
|
+
d = dir.read
|
|
977
|
+
assert_not_nil d
|
|
978
|
+
d = dir.read
|
|
979
|
+
assert_not_nil d
|
|
980
|
+
d = dir.read
|
|
981
|
+
assert_not_nil d
|
|
982
|
+
d = dir.read
|
|
983
|
+
assert_not_nil d
|
|
984
|
+
d = dir.read
|
|
985
|
+
assert_not_nil d
|
|
986
|
+
d = dir.read
|
|
987
|
+
assert_nil d
|
|
988
|
+
end
|
|
989
|
+
|
|
990
|
+
def test_directory_rewind
|
|
991
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
992
|
+
|
|
993
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
994
|
+
test.each do |f|
|
|
995
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
996
|
+
end
|
|
997
|
+
|
|
998
|
+
dir = Dir.new('/this/path/should/be/here')
|
|
999
|
+
|
|
1000
|
+
d = dir.read
|
|
1001
|
+
d = dir.read
|
|
1002
|
+
assert dir.pos == 2
|
|
1003
|
+
dir.rewind
|
|
1004
|
+
assert dir.pos == 0
|
|
1005
|
+
end
|
|
1006
|
+
|
|
1007
|
+
def test_directory_seek
|
|
1008
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
1009
|
+
|
|
1010
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
1011
|
+
test.each do |f|
|
|
1012
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
1013
|
+
end
|
|
1014
|
+
|
|
1015
|
+
dir = Dir.new('/this/path/should/be/here')
|
|
1016
|
+
|
|
1017
|
+
d = dir.seek 1
|
|
1018
|
+
assert d == '..'
|
|
1019
|
+
assert dir.pos == 1
|
|
1020
|
+
end
|
|
1021
|
+
|
|
1022
|
+
def test_directory_class_delete
|
|
1023
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
1024
|
+
Dir.delete('/this/path/should/be/here')
|
|
1025
|
+
assert File.exists?('/this/path/should/be/here') == false
|
|
1026
|
+
end
|
|
1027
|
+
|
|
1028
|
+
def test_directory_class_delete_does_not_act_on_non_empty_directory
|
|
1029
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
1030
|
+
|
|
1031
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
1032
|
+
test.each do |f|
|
|
1033
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
1034
|
+
end
|
|
1035
|
+
|
|
1036
|
+
assert_raises(SystemCallError) do
|
|
1037
|
+
Dir.delete('/this/path/should/be/here')
|
|
1038
|
+
end
|
|
1039
|
+
end
|
|
1040
|
+
|
|
1041
|
+
def test_directory_entries
|
|
1042
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
1043
|
+
|
|
1044
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
1045
|
+
|
|
1046
|
+
test.each do |f|
|
|
1047
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
1048
|
+
end
|
|
1049
|
+
|
|
1050
|
+
yielded = Dir.entries('/this/path/should/be/here')
|
|
1051
|
+
assert yielded.size == test.size
|
|
1052
|
+
test.each { |t| assert yielded.include?(t) }
|
|
1053
|
+
end
|
|
1054
|
+
|
|
1055
|
+
def test_directory_entries_works_with_trailing_slash
|
|
1056
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
1057
|
+
|
|
1058
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
1059
|
+
|
|
1060
|
+
test.each do |f|
|
|
1061
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
1062
|
+
end
|
|
1063
|
+
|
|
1064
|
+
yielded = Dir.entries('/this/path/should/be/here/')
|
|
1065
|
+
assert yielded.size == test.size
|
|
1066
|
+
test.each { |t| assert yielded.include?(t) }
|
|
1067
|
+
end
|
|
1068
|
+
|
|
1069
|
+
def test_directory_foreach
|
|
1070
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
1071
|
+
|
|
1072
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
1073
|
+
|
|
1074
|
+
test.each do |f|
|
|
1075
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
1076
|
+
end
|
|
1077
|
+
|
|
1078
|
+
yielded = []
|
|
1079
|
+
Dir.foreach('/this/path/should/be/here') do |dir|
|
|
1080
|
+
yielded << dir
|
|
1081
|
+
end
|
|
1082
|
+
|
|
1083
|
+
assert yielded.size == test.size
|
|
1084
|
+
test.each { |t| assert yielded.include?(t) }
|
|
1085
|
+
end
|
|
1086
|
+
|
|
1087
|
+
def test_directory_mkdir
|
|
1088
|
+
Dir.mkdir('/path')
|
|
1089
|
+
assert File.exists?('/path')
|
|
1090
|
+
end
|
|
1091
|
+
|
|
1092
|
+
def test_directory_mkdir_relative
|
|
1093
|
+
FileUtils.mkdir_p('/new/root')
|
|
1094
|
+
FileSystem.chdir('/new/root')
|
|
1095
|
+
Dir.mkdir('path')
|
|
1096
|
+
assert File.exists?('/new/root/path')
|
|
1097
|
+
end
|
|
1098
|
+
|
|
1099
|
+
def test_directory_mkdir_not_recursive
|
|
1100
|
+
assert_raises(Errno::ENOENT) do
|
|
1101
|
+
Dir.mkdir('/path/does/not/exist')
|
|
1102
|
+
end
|
|
1103
|
+
end
|
|
1104
|
+
|
|
1105
|
+
def test_directory_open
|
|
1106
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
1107
|
+
|
|
1108
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
1109
|
+
|
|
1110
|
+
test.each do |f|
|
|
1111
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
1112
|
+
end
|
|
1113
|
+
|
|
1114
|
+
dir = Dir.open('/this/path/should/be/here')
|
|
1115
|
+
assert dir.path == '/this/path/should/be/here'
|
|
1116
|
+
end
|
|
1117
|
+
|
|
1118
|
+
def test_directory_open_block
|
|
1119
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
1120
|
+
|
|
1121
|
+
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
1122
|
+
|
|
1123
|
+
test.each do |f|
|
|
1124
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
1125
|
+
end
|
|
1126
|
+
|
|
1127
|
+
yielded = []
|
|
1128
|
+
Dir.open('/this/path/should/be/here') do |dir|
|
|
1129
|
+
yielded << dir
|
|
1130
|
+
end
|
|
1131
|
+
|
|
1132
|
+
assert yielded.size == test.size
|
|
1133
|
+
test.each { |t| assert yielded.include?(t) }
|
|
1134
|
+
end
|
|
1135
|
+
|
|
1136
|
+
def test_tmpdir
|
|
1137
|
+
assert Dir.tmpdir == "/tmp"
|
|
1138
|
+
end
|
|
1139
|
+
|
|
1140
|
+
def test_hard_link_creates_file
|
|
1141
|
+
FileUtils.touch("/foo")
|
|
1142
|
+
|
|
1143
|
+
File.link("/foo", "/bar")
|
|
1144
|
+
assert File.exists?("/bar")
|
|
1145
|
+
end
|
|
1146
|
+
|
|
1147
|
+
def test_hard_link_with_missing_file_raises_error
|
|
1148
|
+
assert_raises(Errno::ENOENT) do
|
|
1149
|
+
File.link("/foo", "/bar")
|
|
1150
|
+
end
|
|
1151
|
+
end
|
|
1152
|
+
|
|
1153
|
+
def test_hard_link_with_existing_destination_file
|
|
1154
|
+
FileUtils.touch("/foo")
|
|
1155
|
+
FileUtils.touch("/bar")
|
|
1156
|
+
|
|
1157
|
+
assert_raises(Errno::EEXIST) do
|
|
1158
|
+
File.link("/foo", "/bar")
|
|
1159
|
+
end
|
|
1160
|
+
end
|
|
1161
|
+
|
|
1162
|
+
def test_hard_link_returns_0_when_successful
|
|
1163
|
+
FileUtils.touch("/foo")
|
|
1164
|
+
|
|
1165
|
+
assert_equal 0, File.link("/foo", "/bar")
|
|
1166
|
+
end
|
|
1167
|
+
|
|
1168
|
+
def test_hard_link_returns_duplicate_file
|
|
1169
|
+
File.open("/foo", "w") { |x| x << "some content" }
|
|
1170
|
+
|
|
1171
|
+
File.link("/foo", "/bar")
|
|
1172
|
+
assert_equal "some content", File.read("/bar")
|
|
1173
|
+
end
|
|
1174
|
+
|
|
1175
|
+
def test_hard_link_with_directory_raises_error
|
|
1176
|
+
Dir.mkdir "/foo"
|
|
1177
|
+
|
|
1178
|
+
assert_raises(Errno::EPERM) do
|
|
1179
|
+
File.link("/foo", "/bar")
|
|
1180
|
+
end
|
|
1181
|
+
end
|
|
1182
|
+
|
|
1183
|
+
def test_file_stat_returns_file_stat_object
|
|
1184
|
+
FileUtils.touch("/foo")
|
|
1185
|
+
assert_equal File::Stat, File.stat("/foo").class
|
|
1186
|
+
end
|
|
1187
|
+
|
|
1188
|
+
def test_can_delete_file_with_delete
|
|
1189
|
+
FileUtils.touch("/foo")
|
|
1190
|
+
|
|
1191
|
+
File.delete("/foo")
|
|
1192
|
+
|
|
1193
|
+
assert !File.exists?("/foo")
|
|
1194
|
+
end
|
|
1195
|
+
|
|
1196
|
+
def test_can_delete_multiple_files_with_delete
|
|
1197
|
+
FileUtils.touch("/foo")
|
|
1198
|
+
FileUtils.touch("/bar")
|
|
1199
|
+
|
|
1200
|
+
File.delete("/foo", "/bar")
|
|
1201
|
+
|
|
1202
|
+
assert !File.exists?("/foo")
|
|
1203
|
+
assert !File.exists?("/bar")
|
|
1204
|
+
end
|
|
1205
|
+
|
|
1206
|
+
def test_delete_raises_argument_error_with_no_filename_given
|
|
1207
|
+
assert_raises ArgumentError do
|
|
1208
|
+
File.delete
|
|
1209
|
+
end
|
|
1210
|
+
end
|
|
1211
|
+
|
|
1212
|
+
def test_delete_returns_number_one_when_given_one_arg
|
|
1213
|
+
FileUtils.touch("/foo")
|
|
1214
|
+
|
|
1215
|
+
assert_equal 1, File.delete("/foo")
|
|
1216
|
+
end
|
|
1217
|
+
|
|
1218
|
+
def test_delete_returns_number_two_when_given_two_args
|
|
1219
|
+
FileUtils.touch("/foo")
|
|
1220
|
+
FileUtils.touch("/bar")
|
|
1221
|
+
|
|
1222
|
+
assert_equal 2, File.delete("/foo", "/bar")
|
|
1223
|
+
end
|
|
1224
|
+
|
|
1225
|
+
def test_delete_raises_error_when_first_file_does_not_exist
|
|
1226
|
+
assert_raises Errno::ENOENT do
|
|
1227
|
+
File.delete("/foo")
|
|
1228
|
+
end
|
|
1229
|
+
end
|
|
1230
|
+
|
|
1231
|
+
def test_delete_does_not_raise_error_when_second_file_does_not_exist
|
|
1232
|
+
FileUtils.touch("/foo")
|
|
1233
|
+
|
|
1234
|
+
assert_nothing_raised do
|
|
1235
|
+
File.delete("/foo", "/bar")
|
|
1236
|
+
end
|
|
1237
|
+
end
|
|
1238
|
+
|
|
1239
|
+
def test_unlink_is_alias_for_delete
|
|
1240
|
+
assert_equal File.method(:unlink), File.method(:delete)
|
|
1241
|
+
end
|
|
1242
|
+
|
|
1243
|
+
def test_unlink_removes_only_one_file_content
|
|
1244
|
+
File.open("/foo", "w") { |f| f << "some_content" }
|
|
1245
|
+
File.link("/foo", "/bar")
|
|
1246
|
+
|
|
1247
|
+
File.unlink("/bar")
|
|
1248
|
+
File.read("/foo") == "some_content"
|
|
1249
|
+
end
|
|
1250
|
+
|
|
1251
|
+
def test_link_reports_correct_stat_info_after_unlinking
|
|
1252
|
+
File.open("/foo", "w") { |f| f << "some_content" }
|
|
1253
|
+
File.link("/foo", "/bar")
|
|
1254
|
+
|
|
1255
|
+
File.unlink("/bar")
|
|
1256
|
+
assert_equal 1, File.stat("/foo").nlink
|
|
1257
|
+
end
|
|
1258
|
+
|
|
1259
|
+
def test_delete_works_with_symlink
|
|
1260
|
+
FileUtils.touch("/foo")
|
|
1261
|
+
File.symlink("/foo", "/bar")
|
|
1262
|
+
|
|
1263
|
+
File.unlink("/bar")
|
|
1264
|
+
|
|
1265
|
+
assert File.exists?("/foo")
|
|
1266
|
+
assert !File.exists?("/bar")
|
|
1267
|
+
end
|
|
1268
|
+
|
|
1269
|
+
def test_delete_works_with_symlink_source
|
|
1270
|
+
FileUtils.touch("/foo")
|
|
1271
|
+
File.symlink("/foo", "/bar")
|
|
1272
|
+
|
|
1273
|
+
File.unlink("/foo")
|
|
1274
|
+
|
|
1275
|
+
assert !File.exists?("/foo")
|
|
1276
|
+
end
|
|
1277
|
+
|
|
1278
|
+
def test_file_seek_returns_0
|
|
1279
|
+
File.open("/foo", "w") do |f|
|
|
1280
|
+
f << "one\ntwo\nthree"
|
|
1281
|
+
end
|
|
1282
|
+
|
|
1283
|
+
file = File.open("/foo", "r")
|
|
1284
|
+
|
|
1285
|
+
assert_equal 0, file.seek(1)
|
|
1286
|
+
end
|
|
1287
|
+
|
|
1288
|
+
def test_file_seek_seeks_to_location
|
|
1289
|
+
File.open("/foo", "w") do |f|
|
|
1290
|
+
f << "123"
|
|
1291
|
+
end
|
|
1292
|
+
|
|
1293
|
+
file = File.open("/foo", "r")
|
|
1294
|
+
file.seek(1)
|
|
1295
|
+
assert_equal "23", file.read
|
|
1296
|
+
end
|
|
1297
|
+
|
|
1298
|
+
def test_file_seek_seeks_to_correct_location
|
|
1299
|
+
File.open("/foo", "w") do |f|
|
|
1300
|
+
f << "123"
|
|
1301
|
+
end
|
|
1302
|
+
|
|
1303
|
+
file = File.open("/foo", "r")
|
|
1304
|
+
file.seek(2)
|
|
1305
|
+
assert_equal "3", file.read
|
|
1306
|
+
end
|
|
1307
|
+
|
|
1308
|
+
def test_file_seek_can_take_negative_offset
|
|
1309
|
+
File.open("/foo", "w") do |f|
|
|
1310
|
+
f << "123456789"
|
|
1311
|
+
end
|
|
1312
|
+
|
|
1313
|
+
file = File.open("/foo", "r")
|
|
1314
|
+
|
|
1315
|
+
file.seek(-1, IO::SEEK_END)
|
|
1316
|
+
assert_equal "9", file.read
|
|
1317
|
+
|
|
1318
|
+
file.seek(-2, IO::SEEK_END)
|
|
1319
|
+
assert_equal "89", file.read
|
|
1320
|
+
|
|
1321
|
+
file.seek(-3, IO::SEEK_END)
|
|
1322
|
+
assert_equal "789", file.read
|
|
1323
|
+
end
|
|
1324
|
+
|
|
1325
|
+
def test_should_have_constants_inherited_from_descending_from_io
|
|
1326
|
+
assert_equal IO::SEEK_CUR, File::SEEK_CUR
|
|
1327
|
+
assert_equal IO::SEEK_END, File::SEEK_END
|
|
1328
|
+
assert_equal IO::SEEK_SET, File::SEEK_SET
|
|
1329
|
+
end
|
|
1330
|
+
|
|
1331
|
+
def here(fname)
|
|
1332
|
+
RealFile.expand_path(RealFile.dirname(__FILE__)+'/'+fname)
|
|
1333
|
+
end
|
|
1334
|
+
end
|