mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
parent
d5972640ab
commit
6f0d5aae9f
3 changed files with 23 additions and 3 deletions
|
@ -3,7 +3,7 @@ module Rspec
|
|||
source_root File.expand_path('../templates', __FILE__)
|
||||
|
||||
def create_spec_file
|
||||
template 'decorator_spec.rb', File.join('spec/decorators', "#{singular_name}_decorator_spec.rb")
|
||||
template 'decorator_spec.rb', File.join('spec/decorators', class_path, "#{singular_name}_decorator_spec.rb")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module TestUnit
|
|||
source_root File.expand_path('../templates', __FILE__)
|
||||
|
||||
def create_test_file
|
||||
template 'decorator_test.rb', File.join('test/decorators', "#{singular_name}_decorator_test.rb")
|
||||
template 'decorator_test.rb', File.join('test/decorators', class_path, "#{singular_name}_decorator_test.rb")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -65,7 +65,17 @@ describe Rails::Generators::DecoratorGenerator do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using rspec' do
|
||||
context 'using rspec with namespaced model' do
|
||||
before { run_generator ["Namespace::YourModel", "-t=rspec"] }
|
||||
|
||||
describe 'spec/decorators/your_model_decorator_spec.rb' do
|
||||
subject { file('spec/decorators/namespace/your_model_decorator_spec.rb') }
|
||||
it { should exist }
|
||||
it { should contain "describe Namespace::YourModelDecorator" }
|
||||
end
|
||||
end
|
||||
|
||||
context 'using test-unit' do
|
||||
before { run_generator ["YourModel", "-t=test_unit"] }
|
||||
|
||||
describe 'test/decorators/YourModel_decorator_test.rb' do
|
||||
|
@ -74,4 +84,14 @@ describe Rails::Generators::DecoratorGenerator do
|
|||
it { should contain "class YourModelDecoratorTest < ActiveSupport::TestCase" }
|
||||
end
|
||||
end
|
||||
|
||||
context 'using test-unit with namespaced model' do
|
||||
before { run_generator ["Namespace::YourModel", "-t=test_unit"] }
|
||||
|
||||
describe 'test/decorators/your_model_decorator_test.rb' do
|
||||
subject { file('test/decorators/namespace/your_model_decorator_test.rb') }
|
||||
it { should exist }
|
||||
it { should contain "class Namespace::YourModelDecoratorTest < ActiveSupport::TestCase" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue