Wrote a failing test to demonstrate issue with the way import handles the content_type.name attribute.
This commit is contained in:
parent
7f1c9282c7
commit
707973be16
|
@ -18,6 +18,18 @@ Factory.define "another site", :parent => "test site" do |s|
|
|||
s.subdomain "test2"
|
||||
end
|
||||
|
||||
Factory.define "existing site", :parent => "site" do |s|
|
||||
s.name "Locomotive site with existing models"
|
||||
s.subdomain "models"
|
||||
s.after_build do |site_with_models|
|
||||
site_with_models.content_types.build(
|
||||
:slug => 'projects',
|
||||
:name => 'Existing name',
|
||||
:description => 'Existing description',
|
||||
:order_by => 'created_at')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Accounts ##
|
||||
Factory.define :account do |a|
|
||||
|
|
|
@ -24,6 +24,11 @@ describe Locomotive::Import::Job do
|
|||
content_type = @site.content_types.where(:slug => 'projects').first
|
||||
content_type.content_custom_fields.size.should == 9
|
||||
end
|
||||
|
||||
it 'correctly imports content type names' do
|
||||
content_type = @site.content_types.where(:slug => 'projects').first
|
||||
content_type.name.should == 'My projects'
|
||||
end
|
||||
|
||||
it 'converts correctly the order_by option for content types' do
|
||||
content_type = @site.content_types.where(:slug => 'messages').first
|
||||
|
@ -76,5 +81,35 @@ describe Locomotive::Import::Job do
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
context 'with an existing site' do
|
||||
before(:all) do
|
||||
@site = Factory("existing site")
|
||||
|
||||
job = Locomotive::Import::Job.new(FixturedTheme.duplicate_and_open('default.zip'), @site, { :samples => true, :reset => true })
|
||||
job.perform
|
||||
|
||||
job.success nil
|
||||
end
|
||||
|
||||
context 'updates to content_type attributes' do
|
||||
before(:all) do
|
||||
@projects = content_type = @site.content_types.where(:slug => 'projects').first
|
||||
end
|
||||
|
||||
it 'includes new name' do
|
||||
@projects.name.should == 'My projects'
|
||||
end
|
||||
|
||||
it 'includes new description' do
|
||||
@projects.description.should == 'My portfolio'
|
||||
end
|
||||
|
||||
it 'includes new order by' do
|
||||
@projects.order_by.should == '_position_in_list'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
Loading…
Reference in New Issue