engine/spec/models/locomotive/editable_file_spec.rb
Didier Lafforgue 0c65516807 fix issue #320
2012-03-08 02:32:59 +01:00

26 lines
708 B
Ruby

require 'spec_helper'
describe Locomotive::EditableElement do
before(:each) do
@site = FactoryGirl.create(:site)
@home = @site.pages.root.first
@home.update_attributes :raw_template => "{% block body %}{% editable_file 'image' %}Lorem ipsum{% endeditable_file %}{% endblock %}"
@home = @site.pages.root.first
end
it 'has one editable file element' do
@home.editable_elements.size.should == 1
@home.editable_elements.first.slug.should == 'image'
end
it 'does not have 2 image fields' do
editable_file = @home.editable_elements.first
fields = editable_file.class.fields.keys
(fields.include?('source') && fields.include?(:source)).should be_false
end
end