diff --git a/app/models/locomotive/extensions/page/templatized.rb b/app/models/locomotive/extensions/page/templatized.rb index 10d7c5fb..5f5d36b8 100644 --- a/app/models/locomotive/extensions/page/templatized.rb +++ b/app/models/locomotive/extensions/page/templatized.rb @@ -7,7 +7,7 @@ module Locomotive included do - referenced_in :content_type + referenced_in :content_type, :class_name => 'Locomotive::ContentType' field :templatized, :type => Boolean, :default => false @@ -27,4 +27,4 @@ module Locomotive end end end -end \ No newline at end of file +end diff --git a/app/models/locomotive/membership.rb b/app/models/locomotive/membership.rb index 0806c74a..9053a6c5 100644 --- a/app/models/locomotive/membership.rb +++ b/app/models/locomotive/membership.rb @@ -29,7 +29,7 @@ module Locomotive def email=(email) @email = email - self.account = Account.where(:email => email).first + self.account = Locomotive::Account.where(:email => email).first end def process! @@ -72,4 +72,4 @@ module Locomotive end end -end \ No newline at end of file +end diff --git a/lib/locomotive/routing/site_dispatcher.rb b/lib/locomotive/routing/site_dispatcher.rb index d8494cbb..8bbffa07 100644 --- a/lib/locomotive/routing/site_dispatcher.rb +++ b/lib/locomotive/routing/site_dispatcher.rb @@ -33,13 +33,13 @@ module Locomotive def require_site return true if current_site - redirect_to installation_url and return false if Account.count == 0 || Site.count == 0 + redirect_to installation_url and return false if Locomotive::Account.count == 0 || Locomotive::Site.count == 0 render_no_site_error and return false end def render_no_site_error - render :template => '/admin/errors/no_site', :layout => false, :status => :not_found + render :template => '/Locomotive/errors/no_site', :layout => false, :status => :not_found end def validate_site_membership diff --git a/spec/cells/locomotive/global_actions_spec.rb b/spec/cells/locomotive/global_actions_spec.rb index d9821fb1..e2db9733 100644 --- a/spec/cells/locomotive/global_actions_spec.rb +++ b/spec/cells/locomotive/global_actions_spec.rb @@ -5,7 +5,7 @@ describe Locomotive::GlobalActionsCell do # as if it were a controller. # render_views - let(:menu) { render_cell('admin/global_actions', :show, :current_locomotive_account => FactoryGirl.build('admin user'), :current_site_url => 'http://www.yahoo.fr') } + let(:menu) { render_cell('locomotive/global_actions', :show, :current_locomotive_account => FactoryGirl.build('admin user'), :current_site_url => 'http://www.yahoo.fr') } describe 'show menu' do @@ -18,7 +18,7 @@ describe Locomotive::GlobalActionsCell do end it 'has a link to edit my account' do - menu.should have_link('Admin') + menu.should have_link('Locomotive') end it 'has a link to see my website' do @@ -35,7 +35,7 @@ describe Locomotive::GlobalActionsCell do before(:each) do CellsResetter.new_global_actions_cell_klass({ :main => 'settings', :sub => 'site' }) - Admin::GlobalActionsCell.update_for(:testing_add) { |m| m.add(:my_link, :label => 'My link', :url => 'http://www.locomotivecms.com') } + Locomotive::GlobalActionsCell.update_for(:testing_add) { |m| m.add(:my_link, :label => 'My link', :url => 'http://www.locomotivecms.com') } end it 'has 4 items' do @@ -52,7 +52,7 @@ describe Locomotive::GlobalActionsCell do before(:each) do CellsResetter.new_global_actions_cell_klass({ :main => 'settings', :sub => 'site' }) - Admin::GlobalActionsCell.update_for(:testing_remove) { |m| m.remove(:see) } + Locomotive::GlobalActionsCell.update_for(:testing_remove) { |m| m.remove(:see) } end it 'has 2 items' do @@ -69,7 +69,7 @@ describe Locomotive::GlobalActionsCell do before(:each) do CellsResetter.new_global_actions_cell_klass({ :main => 'settings', :sub => 'site' }) - Admin::GlobalActionsCell.update_for(:testing_update) { |m| m.modify(:see, { :label => 'Modified !' }) } + Locomotive::GlobalActionsCell.update_for(:testing_update) { |m| m.modify(:see, { :label => 'Modified !' }) } end it 'still has 3 items' do diff --git a/spec/cells/locomotive/main_menu_cell_spec.rb b/spec/cells/locomotive/main_menu_cell_spec.rb index 4dc24ed5..4521a61a 100644 --- a/spec/cells/locomotive/main_menu_cell_spec.rb +++ b/spec/cells/locomotive/main_menu_cell_spec.rb @@ -5,7 +5,7 @@ describe Locomotive::MainMenuCell do # as if it were a controller. # render_views - let(:menu) { render_cell('admin/main_menu', :show) } + let(:menu) { render_cell('locomotive/main_menu', :show) } describe 'show menu' do @@ -31,7 +31,7 @@ describe Locomotive::MainMenuCell do before(:each) do CellsResetter.new_main_menu_cell_klass({ :main => 'settings', :sub => 'site' }) - Admin::MainMenuCell.update_for(:testing_add) { |m| m.add(:my_link, :label => 'Shop', :url => 'http://www.locomotivecms.com') } + Locomotive::MainMenuCell.update_for(:testing_add) { |m| m.add(:my_link, :label => 'Shop', :url => 'http://www.locomotivecms.com') } end it 'has 3 items' do @@ -48,7 +48,7 @@ describe Locomotive::MainMenuCell do before(:each) do CellsResetter.new_main_menu_cell_klass({ :main => 'settings', :sub => 'site' }) - Admin::MainMenuCell.update_for(:testing_remove) { |m| m.remove(:settings) } + Locomotive::MainMenuCell.update_for(:testing_remove) { |m| m.remove(:settings) } end it 'has only 1 item' do @@ -65,7 +65,7 @@ describe Locomotive::MainMenuCell do before(:each) do CellsResetter.new_main_menu_cell_klass({ :main => 'settings', :sub => 'site' }) - Admin::MainMenuCell.update_for(:testing_update) { |m| m.modify(:settings, { :label => 'Modified !' }) } + Locomotive::MainMenuCell.update_for(:testing_update) { |m| m.modify(:settings, { :label => 'Modified !' }) } end it 'still has 2 items' do diff --git a/spec/cells/locomotive/settings_menu_cell_spec.rb b/spec/cells/locomotive/settings_menu_cell_spec.rb index 2ac44e18..00a8b0f7 100644 --- a/spec/cells/locomotive/settings_menu_cell_spec.rb +++ b/spec/cells/locomotive/settings_menu_cell_spec.rb @@ -5,7 +5,7 @@ describe Locomotive::SettingsMenuCell do # as if it were a controller. # render_views - let(:menu) { render_cell('admin/settings_menu', :show) } + let(:menu) { render_cell('locomotive/settings_menu', :show) } describe 'show menu' do @@ -35,7 +35,7 @@ describe Locomotive::SettingsMenuCell do before(:each) do CellsResetter.new_settings_menu_cell_klass({ :main => 'settings', :sub => 'site' }) - Admin::SettingsMenuCell.update_for(:testing_add) { |m| m.add(:my_link, :label => 'My link', :url => 'http://www.locomotivecms.com') } + Locomotive::SettingsMenuCell.update_for(:testing_add) { |m| m.add(:my_link, :label => 'My link', :url => 'http://www.locomotivecms.com') } end it 'has 4 items' do @@ -52,7 +52,7 @@ describe Locomotive::SettingsMenuCell do before(:each) do CellsResetter.new_settings_menu_cell_klass({ :main => 'settings', :sub => 'site' }) - Admin::SettingsMenuCell.update_for(:testing_remove) { |m| m.remove(:theme_assets) } + Locomotive::SettingsMenuCell.update_for(:testing_remove) { |m| m.remove(:theme_assets) } end it 'has 2 items' do @@ -69,7 +69,7 @@ describe Locomotive::SettingsMenuCell do before(:each) do CellsResetter.new_settings_menu_cell_klass({ :main => 'settings', :sub => 'site' }) - Admin::SettingsMenuCell.update_for(:testing_update) { |m| m.modify(:theme_assets, { :label => 'Modified !' }) } + Locomotive::SettingsMenuCell.update_for(:testing_update) { |m| m.modify(:theme_assets, { :label => 'Modified !' }) } end it 'still has 3 items' do diff --git a/spec/lib/locomotive/liquid/drops/page_spec.rb b/spec/lib/locomotive/liquid/drops/page_spec.rb index 7b9c1e83..7ebc9ed8 100644 --- a/spec/lib/locomotive/liquid/drops/page_spec.rb +++ b/spec/lib/locomotive/liquid/drops/page_spec.rb @@ -11,13 +11,13 @@ describe Locomotive::Liquid::Drops::Page do before(:each) do @home.stubs(:children).returns([ - Page.new(:title => 'Child #1'), - Page.new(:title => 'Child #2'), - Page.new(:title => 'Child #3') + Locomotive::Page.new(:title => 'Child #1'), + Locomotive::Page.new(:title => 'Child #2'), + Locomotive::Page.new(:title => 'Child #3') ]) @home.children.last.stubs(:children).returns([ - Page.new(:title => 'Child #3.1'), - Page.new(:title => 'Child #3.2') + Locomotive::Page.new(:title => 'Child #3.1'), + Locomotive::Page.new(:title => 'Child #3.2') ]) end diff --git a/spec/lib/locomotive/liquid/tags/editable/content_spec.rb b/spec/lib/locomotive/liquid/tags/editable/content_spec.rb index f3eb9ae4..5a78da65 100644 --- a/spec/lib/locomotive/liquid/tags/editable/content_spec.rb +++ b/spec/lib/locomotive/liquid/tags/editable/content_spec.rb @@ -21,7 +21,7 @@ describe Locomotive::Liquid::Tags::Editable::Content do context 'output' do before :each do - EditableElement.any_instance.stubs(:content).returns("test string") + Locomotive::EditableElement.any_instance.stubs(:content).returns("test string") end context 'inheriting from a parent' do diff --git a/spec/lib/locomotive/liquid/tags/nav_spec.rb b/spec/lib/locomotive/liquid/tags/nav_spec.rb index 37a01293..ad4d38aa 100644 --- a/spec/lib/locomotive/liquid/tags/nav_spec.rb +++ b/spec/lib/locomotive/liquid/tags/nav_spec.rb @@ -5,18 +5,18 @@ describe Locomotive::Liquid::Tags::Nav do before(:each) do @home = FactoryGirl.build(:page) home_children = [ - Page.new(:title => 'Child #1', :fullpath => 'child_1', :slug => 'child_1', :published => true), - Page.new(:title => 'Child #2', :fullpath => 'child_2', :slug => 'child_2', :published => true) + Locomotive::Page.new(:title => 'Child #1', :fullpath => 'child_1', :slug => 'child_1', :published => true), + Locomotive::Page.new(:title => 'Child #2', :fullpath => 'child_2', :slug => 'child_2', :published => true) ] @home.stubs(:children_with_minimal_attributes).returns(home_children) @home.stubs(:children).returns(home_children) other_children = [ - Page.new(:title => 'Child #2.1', :fullpath => 'child_2/sub_child_1', :slug => 'sub_child_1', :published => true), - Page.new(:title => 'Child #2.2', :fullpath => 'child_2/sub_child_2', :slug => 'sub_child_2', :published => true), - Page.new(:title => 'Unpublished #2.2', :fullpath => 'child_2/sub_child_unpublishd_2', :slug => 'sub_child_unpublished_2', :published => false), - Page.new(:title => 'Templatized #2.3', :fullpath => 'child_2/sub_child_template_3', :slug => 'sub_child_template_3', :published => true, :templatized => true), - Page.new(:title => 'Unlisted #2.4', :fullpath => 'child_2/sub_child_unlisted_4', :slug => 'sub_child_unlisted_4', :published => true, :listed => false) + Locomotive::Page.new(:title => 'Child #2.1', :fullpath => 'child_2/sub_child_1', :slug => 'sub_child_1', :published => true), + Locomotive::Page.new(:title => 'Child #2.2', :fullpath => 'child_2/sub_child_2', :slug => 'sub_child_2', :published => true), + Locomotive::Page.new(:title => 'Unpublished #2.2', :fullpath => 'child_2/sub_child_unpublishd_2', :slug => 'sub_child_unpublished_2', :published => false), + Locomotive::Page.new(:title => 'Templatized #2.3', :fullpath => 'child_2/sub_child_template_3', :slug => 'sub_child_template_3', :published => true, :templatized => true), + Locomotive::Page.new(:title => 'Unlisted #2.4', :fullpath => 'child_2/sub_child_unlisted_4', :slug => 'sub_child_unlisted_4', :published => true, :listed => false) ] @home.children.last.stubs(:children_with_minimal_attributes).returns(other_children) @home.children.last.stubs(:children).returns(other_children) diff --git a/spec/lib/locomotive/render_spec.rb b/spec/lib/locomotive/render_spec.rb index e0de8b58..32a9e8cc 100644 --- a/spec/lib/locomotive/render_spec.rb +++ b/spec/lib/locomotive/render_spec.rb @@ -5,9 +5,9 @@ describe 'Locomotive rendering system' do before(:each) do @controller = Locomotive::TestController.new - Site.any_instance.stubs(:create_default_pages!).returns(true) + Locomotive::Site.any_instance.stubs(:create_default_pages!).returns(true) @site = FactoryGirl.build(:site) - Site.stubs(:find).returns(@site) + Locomotive::Site.stubs(:find).returns(@site) @controller.current_site = @site @page = FactoryGirl.build(:page, :site => nil, :published => true) end @@ -101,7 +101,7 @@ describe 'Locomotive rendering system' do it 'should return the 404 page if the page does not exist' do @controller.request.fullpath = '/contact' - (klass = Page).expects(:published).returns([true]) + (klass = Locomotive::Page).expects(:published).returns([true]) @controller.current_site.pages.expects(:not_found).returns(klass) @controller.send(:locomotive_page).should be_true end @@ -141,7 +141,7 @@ describe 'Locomotive rendering system' do it 'returns the 404 page if the instance does not exist' do @content_type.contents.stubs(:where).returns([]) - (klass = Page).expects(:published).returns([true]) + (klass = Locomotive::Page).expects(:published).returns([true]) @controller.current_site.pages.expects(:not_found).returns(klass) @controller.send(:locomotive_page).should be_true @controller.instance_variable_get(:@content_instance).should be_nil @@ -150,7 +150,7 @@ describe 'Locomotive rendering system' do it 'returns the 404 page if the instance is not visible' do @content._visible = false @content_type.contents.stubs(:where).returns([@content]) - (klass = Page).expects(:published).returns([true]) + (klass = Locomotive::Page).expects(:published).returns([true]) @controller.current_site.pages.expects(:not_found).returns(klass) @controller.send(:locomotive_page).should be_true end @@ -167,7 +167,7 @@ describe 'Locomotive rendering system' do it 'should return the 404 page if the page has not been published yet' do @controller.request.fullpath = '/contact' @controller.current_site.pages.expects(:any_in).with({ :fullpath => %w{contact content_type_template} }).returns([@page]) - (klass = Page).expects(:published).returns([true]) + (klass = Locomotive::Page).expects(:published).returns([true]) @controller.current_site.pages.expects(:not_found).returns(klass) @controller.send(:locomotive_page).should be_true end diff --git a/spec/lib/locomotive/routing/site_dispatcher_spec.rb b/spec/lib/locomotive/routing/site_dispatcher_spec.rb index 90d62260..aad6d295 100644 --- a/spec/lib/locomotive/routing/site_dispatcher_spec.rb +++ b/spec/lib/locomotive/routing/site_dispatcher_spec.rb @@ -39,7 +39,7 @@ describe Locomotive::Routing::SiteDispatcher do end it 'returns the site with matching domain if there is no current site instance' do - Site.expects(:match_domain).with('host').returns([@site]) + Locomotive::Site.expects(:match_domain).with('host').returns([@site]) @controller.send(:fetch_site).should == @site end @@ -80,7 +80,7 @@ describe Locomotive::Routing::SiteDispatcher do context 'when there are no accounts' do before :each do - Account.expects(:count).returns(0) + Locomotive::Account.expects(:count).returns(0) @controller.instance_variable_set('@_response', ActionDispatch::Response.new) @controller.expects(:current_site).returns(false) @@ -102,8 +102,8 @@ describe Locomotive::Routing::SiteDispatcher do context 'when there are no sites' do before :each do - Account.expects(:count).returns(1) - Site.expects(:count).returns(0) + Locomotive::Account.expects(:count).returns(1) + Locomotive::Site.expects(:count).returns(0) @controller.instance_variable_set('@_response', ActionDispatch::Response.new) @controller.expects(:current_site).returns(false) @@ -125,8 +125,8 @@ describe Locomotive::Routing::SiteDispatcher do context 'when there is no current site' do before :each do - Account.expects(:count).returns(1) - Site.expects(:count).returns(1) + Locomotive::Account.expects(:count).returns(1) + Locomotive::Site.expects(:count).returns(1) @controller.instance_variable_set('@_response', ActionDispatch::Response.new) @controller.expects(:current_site).returns(false) diff --git a/spec/models/locomotive/snippet_spec.rb b/spec/models/locomotive/snippet_spec.rb index a09d62da..e8fcd670 100644 --- a/spec/models/locomotive/snippet_spec.rb +++ b/spec/models/locomotive/snippet_spec.rb @@ -31,7 +31,7 @@ describe Locomotive::Snippet do it 'updates templates with the new snippet template' do @snippet.update_attributes(:template => 'a new template') - Page.find(@page.id).render({}).should == 'a new template' + Locomotive::Page.find(@page.id).render({}).should == 'a new template' end end @@ -44,7 +44,7 @@ describe Locomotive::Snippet do it 'updates templates with the new snippet template' do @snippet.update_attributes(:template => 'a new template') - Page.find(@page.id).render({}).should == 'a new template' + Locomotive::Page.find(@page.id).render({}).should == 'a new template' end end diff --git a/spec/requests/seo_trailing_slash_spec.rb b/spec/requests/seo_trailing_slash_spec.rb index 44181075..0f4277d6 100644 --- a/spec/requests/seo_trailing_slash_spec.rb +++ b/spec/requests/seo_trailing_slash_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'Locomotive::Middlewares::SeoTrailingSlash' do before(:all) do - Locomotive::Application.instance.instance_variable_set(:@app, nil) # re-initialize the stack + Dummy::Application.instance.instance_variable_set(:@app, nil) # re-initialize the stack end it 'does not process the "/" url' do @@ -26,4 +26,4 @@ describe 'Locomotive::Middlewares::SeoTrailingSlash' do response.status.should be(301) end -end \ No newline at end of file +end diff --git a/spec/support/cells.rb b/spec/support/cells.rb index 75fe18e3..21b90f30 100644 --- a/spec/support/cells.rb +++ b/spec/support/cells.rb @@ -10,18 +10,18 @@ module CellsResetter klass_name = name.camelize - ::Admin.send(:remove_const, klass_name) - load "#{name}.rb" + ::Locomotive.send(:remove_const, klass_name) + load "locomotive/#{name}.rb" - "::Admin::#{klass_name}".constantize.any_instance.stubs(:sections).returns(args.first) + "::Locomotive::#{klass_name}".constantize.any_instance.stubs(:sections).returns(args.first) end end def self.clean! [:menu_cell, :main_menu_cell, :global_actions_cell, :settings_menu_cell].each do |name| - ::Admin.send(:remove_const, "#{name.to_s.camelize}") - load "#{name}.rb" + ::Locomotive.send(:remove_const, "#{name.to_s.camelize}") + load "locomotive/#{name}.rb" end end -end \ No newline at end of file +end diff --git a/spec/support/factories.rb b/spec/support/factories.rb index e0772c82..ab00d809 100644 --- a/spec/support/factories.rb +++ b/spec/support/factories.rb @@ -76,7 +76,7 @@ FactoryGirl.define do ## Memberships ## factory :membership, :class => Locomotive::Membership do role 'admin' - account { Account.where(:name => "Bart Simpson").first || Factory('admin user') } + account { Locomotive::Account.where(:name => "Bart Simpson").first || Factory('admin user') } factory :admin do role 'admin'