spec/scaffold_spec_spec.rb in scaffoldhub-0.0.7 vs spec/scaffold_spec_spec.rb in scaffoldhub-0.0.8
- old
+ new
@@ -56,10 +56,16 @@
find_spec(subject, :view, 'templates/edit.html.erb').should_not be_nil
find_spec(subject, :view, 'templates/index.html.erb').should_not be_nil
find_spec(subject, :view, 'templates/show.html.erb').should_not be_nil
end
+ it 'should parse the :rename option' do
+ partial_spec = find_spec(subject, :view, 'templates/partial.erb')
+ partial_spec.should_not be_nil
+ partial_spec[:rename].should == '_NAME.html.erb'
+ end
+
it 'should parse a vanilla template file with a dest attribute' do
template_spec = find_spec(subject, :template, 'templates/other_code_file.erb')
template_spec.should_not be_nil
template_spec[:dest].should == 'lib/other_code_file.rb'
end
@@ -151,10 +157,13 @@
parsed_yaml[:parameter_example].should == 'FIELD_NAME'
model_spec = find_spec_in_array(parsed_yaml[:files], :model, 'templates/model.rb')
model_spec.should_not be_nil
some_file_spec = find_spec_in_array(parsed_yaml[:files], :file, 'templates/jquery/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png')
some_file_spec.should_not be_nil
+ partial_view_spec = find_spec_in_array(parsed_yaml[:files], :view, 'templates/partial.erb')
+ partial_view_spec.should_not be_nil
+ partial_view_spec[:rename].should == '_NAME.html.erb'
end
describe '#adjusted_base_url' do
it 'should use the raw github url when a repo root is specified' do
@@ -219,10 +228,10 @@
])
subject.stubs(:base_url).returns('base')
end
it 'should find the file with the given type and src' do
- Scaffoldhub::TemplateFile.expects(:new).with('some_src', 'some_dest', true, 'base', @status_proc).returns(mock1 = mock)
+ Scaffoldhub::TemplateFile.expects(:new).with('some_src', 'some_dest', nil, true, 'base', @status_proc).returns(mock1 = mock)
subject.find_file(:type1).should == mock1
end
it 'should return nil if the type is not found' do
Scaffoldhub::TemplateFile.expects(:new).never