fix a bug about the editable_file not correctly displayed in a snippet given as an argument of the new nav tag
This commit is contained in:
parent
7ab8110e41
commit
1c902a5448
@ -51,7 +51,7 @@ module Locomotive
|
||||
scope :published, :where => { :published => true }
|
||||
scope :fullpath, lambda { |fullpath| { :where => { :fullpath => fullpath } } }
|
||||
scope :handle, lambda { |handle| { :where => { :handle => handle } } }
|
||||
scope :minimal_attributes, lambda { |attrs=[]| {:only => attrs + %w(title slug fullpath position depth published templatized redirect listed parent_id created_at updated_at) } }
|
||||
scope :minimal_attributes, lambda { |attrs = []| { :only => (attrs || []) + %w(title slug fullpath position depth published templatized redirect listed parent_id site_id created_at updated_at) } }
|
||||
|
||||
## methods ##
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Locomotive::EditableElement do
|
||||
describe Locomotive::EditableFile do
|
||||
|
||||
before(:each) do
|
||||
@site = FactoryGirl.create(:site)
|
||||
@ -22,4 +22,23 @@ describe Locomotive::EditableElement do
|
||||
(fields.include?('source') && fields.include?(:source)).should be_false
|
||||
end
|
||||
|
||||
context 'with an attached file' do
|
||||
|
||||
before(:each) do
|
||||
@editable_file = @home.editable_elements.first
|
||||
@editable_file.source = FixturedAsset.open('5k.png')
|
||||
@home.save
|
||||
end
|
||||
|
||||
it 'has a valid source' do
|
||||
@editable_file.source?.should be_true
|
||||
end
|
||||
|
||||
it 'returns the right path even if the page has been retrieved with the minimum_attributes scope' do
|
||||
@home = @site.pages.minimal_attributes(%w(editable_elements)).root.first
|
||||
@home.editable_elements.first.source?.should be_true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user