Top Level Namespace
Defined Under Namespace
Modules: Padrino
Constant Summary collapse
- RIOT_DECORATOR_TEST =
(<<-TEST).gsub(/^ {10}/, '') unless defined?(RIOT_DECORATOR_TEST) require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb') context "!NAME!Decorator" do context 'can construct a new instance' do setup do !NAME!Decorator.new("Sample", self) end asserts('returns the decorated object')- BACON_DECORATOR_TEST =
(<<-TEST).gsub(/^ {10}/, '') unless defined?(BACON_DECORATOR_TEST) require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb') describe "!NAME!Decorator" do it 'can construct a new instance' do object = "Sample" @!DNAME! = !NAME!Decorator.new(object, self) assert- RSPEC_DECORATOR_TEST =
(<<-TEST).gsub(/^ {10}/, '') unless defined?(RSPEC_DECORATOR_TEST) require 'spec_helper' describe "!NAME!Decorator" do it 'can construct a new instance' do object = "Sample" @!DNAME! = !NAME!Decorator.new(object, self) expect(- SHOULDA_DECORATOR_TEST =
(<<-TEST).gsub(/^ {10}/, '') unless defined?(SHOULDA_DECORATOR_TEST) require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb') class !NAME!DecoratorTest < Test::Unit::TestCase context "!NAME! Decorator" do should 'construct a new instance' do object = "Sample" @!DNAME! = !NAME!Decorator.new(object, self) assert_equal- MINITEST_DECORATOR_TEST =
(<<-TEST).gsub(/^ {10}/, '') unless defined?(MINITEST_DECORATOR_TEST) require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb') describe "!NAME!Decorator" do it 'can construct a new instance' do object = "Sample" @!DNAME! = !NAME!Decorator.new(object, self) ass- TESTSPEC_DECORATOR_TEST =
(<<-TEST).gsub(/^ {10}/, '') unless defined?(TESTSPEC_DECORATOR_TEST) require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb') context "!NAME!Decorator" do specify 'construct a new instance' do object = "Sample" @!DNAME! = !NAME!Decorator.new(object, self) @!D
Instance Method Summary collapse
Instance Method Details
#generate_decorator_test(name) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/generators/components/tests/riot.rb', line 15 def generate_decorator_test(name) contents = RIOT_DECORATOR_TEST.gsub(/!NAME!/, @object_name.camelize).gsub(/!DNAME!/, @object_name) path = [:app] == '.' ? '/..' : '/../..' contents.gsub!(/!PATH!/, path) test_file_path = File.join('test', [:app], 'decorators', "#{@object_name}_decorator_test.rb") create_file destination_root(test_file_path), contents, :skip => true end |