Module: RSpec::Generator::Macro
- Included in:
- Core::ExampleGroup
- Defined in:
- lib/generator-spec/rspec/macro.rb
Instance Method Summary collapse
- #create_rails_app(app_name = nil) ⇒ Object
- #remove_rails_app(app_name = nil) ⇒ Object
- #setup_generator(test_method_name = nil, &block) ⇒ Object
- #with_generator(&block) ⇒ Object
Instance Method Details
#create_rails_app(app_name = nil) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/generator-spec/rspec/macro.rb', line 11 def create_rails_app app_name = nil app_name ||= 'rails_app' Dir.mkdir ::TmpRails.root if !File.directory?(::TmpRails.root) Dir.chdir ::TmpRails.root do FileUtils.rm_rf app_name %x[rails new #{app_name} --force] end end |
#remove_rails_app(app_name = nil) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/generator-spec/rspec/macro.rb', line 20 def remove_rails_app app_name = nil app_name ||= 'rails_app' Dir.mkdir ::TmpRails.root if !File.directory?(::TmpRails.root) Dir.chdir ::TmpRails.root do FileUtils.rm_rf app_name end end |
#setup_generator(test_method_name = nil, &block) ⇒ Object
7 8 9 |
# File 'lib/generator-spec/rspec/macro.rb', line 7 def setup_generator test_method_name=nil, &block RSpec::Generator.setup_generator test_method_name, &block end |
#with_generator(&block) ⇒ Object
3 4 5 |
# File 'lib/generator-spec/rspec/macro.rb', line 3 def with_generator &block RSpec::Generator.with_generator &block end |