alchemy_cms 2.2.rc6 → 2.2.rc7
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +0 -1
- data/.travis.yml +5 -4
- data/Gemfile +7 -8
- data/app/controllers/alchemy/admin/pages_controller.rb +1 -2
- data/app/controllers/alchemy/admin/resources_controller.rb +1 -1
- data/app/controllers/alchemy/base_controller.rb +2 -1
- data/app/controllers/alchemy/pages_controller.rb +5 -5
- data/app/helpers/alchemy/admin/base_helper.rb +2 -0
- data/app/models/alchemy/attachment.rb +2 -1
- data/app/models/alchemy/element.rb +12 -16
- data/app/models/alchemy/page.rb +8 -4
- data/config/locales/alchemy.en.yml +1 -1
- data/db/migrate/20101216151419_add_language_id_to_pages.rb +11 -3
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +2 -2
- data/spec/controllers/admin/clipboard_controller_spec.rb +12 -12
- data/spec/controllers/admin/contents_controller_spec.rb +3 -3
- data/spec/controllers/admin/elements_controller_spec.rb +1 -1
- data/spec/controllers/admin/languages_controller_spec.rb +1 -1
- data/spec/controllers/admin/pages_controller_spec.rb +33 -1
- data/spec/controllers/admin/trash_controller_spec.rb +3 -3
- data/spec/controllers/base_controller_spec.rb +3 -3
- data/spec/controllers/pages_controller_spec.rb +6 -6
- data/spec/dummy/config/database.yml +24 -18
- data/spec/dummy/db/schema.rb +1 -1
- data/spec/factories.rb +5 -5
- data/spec/helpers/admin/contents_helper_spec.rb +1 -1
- data/spec/helpers/admin/elements_helper_spec.rb +2 -2
- data/spec/helpers/admin/essences_helper_spec.rb +1 -1
- data/spec/helpers/elements_helper_spec.rb +35 -35
- data/spec/helpers/essences_helper_spec.rb +1 -1
- data/spec/helpers/pages_helper_spec.rb +27 -27
- data/spec/integration/admin/modules_integration_spec.rb +30 -0
- data/spec/integration/admin/pages_controller_spec.rb +7 -7
- data/spec/integration/pages_controller_spec.rb +38 -24
- data/spec/integration/security_spec.rb +1 -1
- data/spec/models/content_spec.rb +5 -5
- data/spec/models/element_spec.rb +59 -14
- data/spec/models/language_spec.rb +9 -9
- data/spec/models/page_spec.rb +66 -42
- data/spec/models/user_spec.rb +1 -1
- data/spec/page_layout_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- data/spec/support/alchemy/specs_helpers.rb +1 -1
- metadata +36 -34
data/.rspec
CHANGED
data/.travis.yml
CHANGED
@@ -9,8 +9,9 @@ branches:
|
|
9
9
|
only:
|
10
10
|
- master
|
11
11
|
before_script:
|
12
|
-
|
13
|
-
- "sh -c 'cd spec/dummy && RAILS_ENV=test bundle exec rake db:schema:load'"
|
12
|
+
- "sh -c 'cd spec/dummy && RAILS_ENV=test bundle exec rake db:create db:schema:load --trace'"
|
14
13
|
script: "bundle exec rspec spec"
|
15
|
-
|
16
|
-
|
14
|
+
env:
|
15
|
+
- DB=mysql
|
16
|
+
- DB=postgresql
|
17
|
+
- DB=sqlite
|
data/Gemfile
CHANGED
@@ -7,14 +7,15 @@ gem 'jasmine'
|
|
7
7
|
gem 'jasminerice'
|
8
8
|
|
9
9
|
group :test do
|
10
|
+
gem 'sqlite3' if ENV['DB'].nil? || ENV['DB'] == 'sqlite'
|
11
|
+
gem 'mysql2' if ENV['DB'] == 'mysql'
|
12
|
+
gem 'pg' if ENV['DB'] == 'postgresql'
|
10
13
|
gem 'rspec-rails'
|
11
|
-
gem '
|
12
|
-
gem 'factory_girl_rails', '1.4.0'
|
14
|
+
gem 'factory_girl_rails', '~> 1.7.0'
|
13
15
|
gem "capybara"
|
14
|
-
gem 'capybara-webkit'
|
15
|
-
gem "launchy"
|
16
|
+
gem 'capybara-webkit' unless ENV['CI']
|
17
|
+
gem "launchy" unless ENV['CI']
|
16
18
|
gem "database_cleaner"
|
17
|
-
gem "fuubar"
|
18
19
|
end
|
19
20
|
|
20
21
|
group :assets do
|
@@ -24,8 +25,6 @@ group :assets do
|
|
24
25
|
end
|
25
26
|
|
26
27
|
group :development do
|
27
|
-
gem 'ruby-debug19', :require => 'ruby-debug', :platform => :ruby_19
|
28
|
-
gem 'ruby-debug', :platform => :ruby_18
|
29
28
|
gem 'guard-spork'
|
30
29
|
gem 'yard'
|
31
|
-
end
|
30
|
+
end
|
@@ -181,8 +181,7 @@ module Alchemy
|
|
181
181
|
new_language_root = Page.copy(
|
182
182
|
original_language_root,
|
183
183
|
:language_id => params[:languages][:new_lang_id],
|
184
|
-
:language_code => session[:language_code]
|
185
|
-
:layoutpage => params[:layoutpage]
|
184
|
+
:language_code => session[:language_code]
|
186
185
|
)
|
187
186
|
new_language_root.move_to_child_of Page.root
|
188
187
|
original_language_root.copy_children_to(new_language_root)
|
@@ -16,7 +16,7 @@ module Alchemy
|
|
16
16
|
else
|
17
17
|
search_terms = ActiveRecord::Base.sanitize("%#{params[:query]}%")
|
18
18
|
items = resource_handler.model.where(resource_handler.searchable_attributes.map { |attribute|
|
19
|
-
"
|
19
|
+
"#{resource_handler.namespaced_model_name.pluralize}.#{attribute[:name]} LIKE #{search_terms}"
|
20
20
|
}.join(" OR "))
|
21
21
|
end
|
22
22
|
instance_variable_set("@#{resource_handler.resources_name}", items.page(params[:page] || 1).per(per_page_value_for_screen_size))
|
@@ -72,12 +72,12 @@ module Alchemy
|
|
72
72
|
if params[:urlname].blank?
|
73
73
|
@page = Page.language_root_for(Language.get_default.id)
|
74
74
|
else
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
@page = Page.find_by_urlname(params[:urlname])
|
79
|
-
else
|
75
|
+
if params[:lang].blank?
|
76
|
+
@page = Page.contentpages.find_by_urlname(params[:urlname])
|
77
|
+
store_language_in_session(@page.language) if @page.present?
|
80
78
|
return @page
|
79
|
+
else
|
80
|
+
@page = Page.contentpages.find_by_urlname_and_language_id(params[:urlname], session[:language_id])
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
@@ -253,6 +253,8 @@ module Alchemy
|
|
253
253
|
if alchemy_module['engine_name']
|
254
254
|
eval(alchemy_module['engine_name']).url_for(url_options)
|
255
255
|
else
|
256
|
+
# hack to prefix any controller-path with / so it doesn't refer to alchemy/...
|
257
|
+
url_options[:controller] = url_options[:controller].gsub(/^([^\/])/, "/#{$1}")
|
256
258
|
main_app.url_for(url_options)
|
257
259
|
end
|
258
260
|
end
|
@@ -13,7 +13,8 @@ module Alchemy
|
|
13
13
|
validates_as_attachment
|
14
14
|
|
15
15
|
def self.find_paginated(params, per_page)
|
16
|
-
|
16
|
+
attachments = Attachment.arel_table
|
17
|
+
cond = attachments[:name].matches("%#{params[:query]}%").or(attachments[:filename].matches("%#{params[:query]}%"))
|
17
18
|
self.where(cond).page(params[:page] || 1).per(per_page).order(:name)
|
18
19
|
end
|
19
20
|
|
@@ -29,30 +29,26 @@ module Alchemy
|
|
29
29
|
|
30
30
|
# TODO: add a trashed column to elements table
|
31
31
|
scope :trashed, where(:page_id => nil).order('updated_at DESC')
|
32
|
-
scope :not_trashed, where(
|
32
|
+
scope :not_trashed, where(Element.arel_table[:page_id].not_eq(nil))
|
33
33
|
scope :published, where(:public => true)
|
34
|
-
scope :named, lambda { |names| where(
|
34
|
+
scope :named, lambda { |names| where(:name => names) }
|
35
35
|
scope :excluded, lambda { |names| where(arel_table[:name].not_in(names)) }
|
36
36
|
scope :not_in_cell, where(:cell_id => nil)
|
37
37
|
|
38
|
-
# Returns next
|
38
|
+
# Returns next public element from same page.
|
39
|
+
# Pass an element name to get next of this kind.
|
39
40
|
def next(name = nil)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
find_conditions = ["public = 1 AND page_id = ? AND name = ? AND position > ?", self.page.id, name, self.position]
|
44
|
-
end
|
45
|
-
self.class.where(find_conditions).order("position ASC").limit(1)
|
41
|
+
elements = page.elements.published.where(Element.arel_table[:position].gt(position))
|
42
|
+
elements = elements.where(:name => name) if name.present?
|
43
|
+
elements.order("position ASC").limit(1).first
|
46
44
|
end
|
47
45
|
|
48
|
-
# Returns previous
|
46
|
+
# Returns previous public element from same page.
|
47
|
+
# Pass an element name to get previous of this kind.
|
49
48
|
def prev(name = nil)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
find_conditions = ["public = 1 AND page_id = ? AND name = ? AND position < ?", self.page.id, name, self.position]
|
54
|
-
end
|
55
|
-
self.class.where(find_conditions).order("position DESC").limit(1)
|
49
|
+
elements = page.elements.published.where(Element.arel_table[:position].lt(position))
|
50
|
+
elements = elements.where(:name => name) if name.present?
|
51
|
+
elements.order("position DESC").limit(1).first
|
56
52
|
end
|
57
53
|
|
58
54
|
# Stores the page into `to_be_sweeped_pages` (Pages that have to be sweeped after updating element).
|
data/app/models/alchemy/page.rb
CHANGED
@@ -3,11 +3,15 @@ module Alchemy
|
|
3
3
|
class Page < ActiveRecord::Base
|
4
4
|
|
5
5
|
attr_accessible(
|
6
|
+
:do_not_autogenerate,
|
6
7
|
:do_not_sweep,
|
7
8
|
:language_code,
|
9
|
+
:language,
|
8
10
|
:language_id,
|
9
11
|
:language_root,
|
10
12
|
:layoutpage,
|
13
|
+
:locked,
|
14
|
+
:locked_by,
|
11
15
|
:meta_description,
|
12
16
|
:meta_keywords,
|
13
17
|
:name,
|
@@ -64,14 +68,14 @@ module Alchemy
|
|
64
68
|
scope :restricted, where(:restricted => true)
|
65
69
|
scope :not_restricted, where(:restricted => false)
|
66
70
|
scope :public_language_roots, lambda {
|
67
|
-
where(:language_root => true
|
71
|
+
where(:language_root => true, :language_code => Language.all_codes_for_published, :public => true)
|
68
72
|
}
|
69
|
-
scope :all_last_edited_from, lambda { |user| where(:updater_id => user.id).order('
|
73
|
+
scope :all_last_edited_from, lambda { |user| where(:updater_id => user.id).order('updated_at DESC').limit(5) }
|
70
74
|
# Returns all pages that have the given language_id
|
71
75
|
scope :with_language, lambda { |language_id| where(:language_id => language_id) }
|
76
|
+
scope :contentpages, where(:layoutpage => [false, nil]).where(Page.arel_table[:parent_id].not_eq(nil))
|
72
77
|
# Returns all pages that are not locked and public.
|
73
78
|
# Used for flushing all page caches at once.
|
74
|
-
scope :contentpages, where("`alchemy_pages`.`layoutpage` = 0 AND `alchemy_pages`.`parent_id` IS NOT NULL")
|
75
79
|
scope :flushables, not_locked.published.contentpages
|
76
80
|
scope :searchables, not_restricted.published.contentpages
|
77
81
|
|
@@ -402,7 +406,7 @@ module Alchemy
|
|
402
406
|
:locked => false,
|
403
407
|
:locked_by => nil
|
404
408
|
)
|
405
|
-
page = self.new(attributes.except(:id, :updated_at, :created_at, :
|
409
|
+
page = self.new(attributes.except(:id, :updated_at, :created_at, :creator_id, :updater_id, :lft, :rgt, :depth))
|
406
410
|
if page.save
|
407
411
|
# copy the page´s cells
|
408
412
|
source.cells.each do |cell|
|
@@ -161,7 +161,7 @@ en:
|
|
161
161
|
"Image size": "Imagesize"
|
162
162
|
"Image deleted successfully": "Image deleted successfully."
|
163
163
|
"Mandatory": "Mandatory fields"
|
164
|
-
"Page deleted": "Page:
|
164
|
+
"Page deleted": "Page: %{name} deleted."
|
165
165
|
"Page saved": "Page: '%{name}' saved."
|
166
166
|
"Password": "Password"
|
167
167
|
"Paste from clipboard": "Paste from clipboard"
|
@@ -3,8 +3,16 @@ class AddLanguageIdToPages < ActiveRecord::Migration
|
|
3
3
|
add_column :pages, :language_id, :integer
|
4
4
|
rename_column :pages, :language, :language_code
|
5
5
|
rename_column :pages, :language_root_for, :language_root
|
6
|
-
|
7
|
-
|
6
|
+
# PostgreSQL does not support changing string columns to boolean.
|
7
|
+
# We do not have existing Alchemy installations running on postgresql to support anyway,
|
8
|
+
# so it's not critical to recreate the column.
|
9
|
+
if ActiveRecord::Base.connection_config[:adapter] == "postgresql"
|
10
|
+
remove_column :pages, :language_root
|
11
|
+
add_column :pages, :language_root, :boolean
|
12
|
+
else
|
13
|
+
change_column :pages, :language_root, :boolean
|
14
|
+
execute("UPDATE pages SET language_root = 1 WHERE language_root IS NOT NULL")
|
15
|
+
end
|
8
16
|
add_index :pages, :language_id
|
9
17
|
end
|
10
18
|
|
@@ -12,8 +20,8 @@ class AddLanguageIdToPages < ActiveRecord::Migration
|
|
12
20
|
remove_index :pages, :language_id
|
13
21
|
change_column :pages, :language_root, :string
|
14
22
|
rename_column :pages, :language_root, :language_root_for
|
23
|
+
execute("UPDATE pages SET language_root_for = 1 WHERE language_root_for IS NOT NULL")
|
15
24
|
rename_column :pages, :language_code, :language
|
16
|
-
execute("UPDATE pages SET language_root_for = language WHERE language_root IS NOT NULL")
|
17
25
|
remove_column :pages, :language_id
|
18
26
|
end
|
19
27
|
end
|
data/lib/alchemy/version.rb
CHANGED
data/lib/alchemy_cms.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
if defined?(Rails) && Rails::VERSION::MAJOR == 3
|
1
|
+
if defined?(Rails) && Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR == 2
|
2
2
|
require 'acts_as_list'
|
3
3
|
require 'attachment_magic'
|
4
4
|
require 'authlogic'
|
@@ -23,7 +23,7 @@ if defined?(Rails) && Rails::VERSION::MAJOR == 3
|
|
23
23
|
end
|
24
24
|
require File.join(File.dirname(__FILE__), "alchemy", "seeder")
|
25
25
|
else
|
26
|
-
raise "Alchemy 2.
|
26
|
+
raise "Alchemy 2.2 needs Rails 3.2 or higher. You are currently using Rails #{Rails::VERSION::STRING}"
|
27
27
|
end
|
28
28
|
|
29
29
|
module Alchemy
|
@@ -4,41 +4,41 @@ describe Alchemy::Admin::ClipboardController do
|
|
4
4
|
|
5
5
|
before(:each) do
|
6
6
|
activate_authlogic
|
7
|
-
Alchemy::UserSession.create(
|
7
|
+
Alchemy::UserSession.create(FactoryGirl.create(:admin_user))
|
8
8
|
end
|
9
9
|
|
10
10
|
context "clipboard" do
|
11
11
|
|
12
12
|
it "should hold element ids" do
|
13
|
-
@page =
|
14
|
-
@element =
|
15
|
-
@another_element =
|
13
|
+
@page = FactoryGirl.create(:page, :parent_id => Alchemy::Page.rootpage.id)
|
14
|
+
@element = FactoryGirl.create(:element, :page => @page)
|
15
|
+
@another_element = FactoryGirl.create(:element, :page => @page)
|
16
16
|
session['clipboard'] = {'elements' => [{:id => @element.id, :action => 'copy'}]}
|
17
17
|
post(:insert, {:remarkable_type => 'element', :remarkable_id => @another_element.id, :format => :js})
|
18
18
|
session['clipboard']['elements'].should == [{:id => @element.id, :action => 'copy'}, {:id => @another_element.id.to_s, :action => 'copy'}]
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should not have the same element twice" do
|
22
|
-
@page =
|
23
|
-
@element =
|
22
|
+
@page = FactoryGirl.create(:page, :parent_id => Alchemy::Page.rootpage.id)
|
23
|
+
@element = FactoryGirl.create(:element, :page => @page)
|
24
24
|
session['clipboard'] = {'elements' => [{:id => @element.id, :action => 'copy'}]}
|
25
25
|
post(:insert, {:remarkable_type => 'element', :remarkable_id => @element.id, :format => :js})
|
26
26
|
session['clipboard']['elements'].should == [{:id => @element.id, :action => 'copy'}]
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should remove element ids" do
|
30
|
-
@page =
|
31
|
-
@element =
|
32
|
-
@another_element =
|
30
|
+
@page = FactoryGirl.create(:page, :parent_id => Alchemy::Page.rootpage.id)
|
31
|
+
@element = FactoryGirl.create(:element, :page => @page)
|
32
|
+
@another_element = FactoryGirl.create(:element, :page => @page)
|
33
33
|
session['clipboard'] = {'elements' => [{:id => @element.id, :action => 'copy'}, {:id => @another_element.id, :action => 'copy'}]}
|
34
34
|
delete(:remove, {:remarkable_type => 'element', :remarkable_id => @another_element.id, :format => :js})
|
35
35
|
session['clipboard']['elements'].should == [{:id => @element.id, :action => 'copy'}]
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should be clearable" do
|
39
|
-
@page =
|
40
|
-
@element =
|
41
|
-
@another_element =
|
39
|
+
@page = FactoryGirl.create(:page, :parent_id => Alchemy::Page.rootpage.id)
|
40
|
+
@element = FactoryGirl.create(:element, :page => @page)
|
41
|
+
@another_element = FactoryGirl.create(:element, :page => @page)
|
42
42
|
session['clipboard'] = {'elements' => [@element.id, @another_element.id]}
|
43
43
|
delete(:clear, :format => :js)
|
44
44
|
session['clipboard'].should == {}
|
@@ -4,11 +4,11 @@ describe Alchemy::Admin::ContentsController do
|
|
4
4
|
|
5
5
|
before(:each) do
|
6
6
|
activate_authlogic
|
7
|
-
Alchemy::UserSession.create
|
7
|
+
Alchemy::UserSession.create FactoryGirl.create(:admin_user)
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should update a content via ajax" do
|
11
|
-
@element =
|
11
|
+
@element = FactoryGirl.create(:element)
|
12
12
|
post :update, {:id => @element.contents.find_by_name('intro').id, :content => {:body => 'Peters Petshop'}, :format => :js}
|
13
13
|
@element.ingredient('intro').should == "Peters Petshop"
|
14
14
|
end
|
@@ -18,7 +18,7 @@ describe Alchemy::Admin::ContentsController do
|
|
18
18
|
context "with content_ids in params" do
|
19
19
|
|
20
20
|
before(:each) do
|
21
|
-
@element =
|
21
|
+
@element = FactoryGirl.create(:element)
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should reorder the contents" do
|
@@ -6,7 +6,7 @@ describe Alchemy::Admin::ElementsController do
|
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
activate_authlogic
|
9
|
-
Alchemy::UserSession.create
|
9
|
+
Alchemy::UserSession.create FactoryGirl.create(:admin_user)
|
10
10
|
end
|
11
11
|
|
12
12
|
let(:page) { mock_model('Page', {:id => 1, :urlname => 'lulu'}) }
|
@@ -4,7 +4,7 @@ describe Alchemy::Admin::PagesController do
|
|
4
4
|
|
5
5
|
before(:each) do
|
6
6
|
activate_authlogic
|
7
|
-
Alchemy::UserSession.create
|
7
|
+
Alchemy::UserSession.create FactoryGirl.create(:admin_user)
|
8
8
|
end
|
9
9
|
|
10
10
|
describe "#flush" do
|
@@ -16,4 +16,36 @@ describe Alchemy::Admin::PagesController do
|
|
16
16
|
|
17
17
|
end
|
18
18
|
|
19
|
+
describe '#copy_language_tree' do
|
20
|
+
|
21
|
+
before(:each) do
|
22
|
+
@language = Alchemy::Language.get_default
|
23
|
+
@language_root = FactoryGirl.create(:language_root_page, :language => @language, :name => 'Intro')
|
24
|
+
@level_1 = FactoryGirl.create(:public_page, :language => @language, :parent_id => @language_root.id, :visible => true, :name => 'Level 1')
|
25
|
+
@level_2 = FactoryGirl.create(:public_page, :language => @language, :parent_id => @level_1.id, :visible => true, :name => 'Level 2')
|
26
|
+
@level_3 = FactoryGirl.create(:public_page, :language => @language, :parent_id => @level_2.id, :visible => true, :name => 'Level 3')
|
27
|
+
@level_4 = FactoryGirl.create(:public_page, :language => @language, :parent_id => @level_3.id, :visible => true, :name => 'Level 4')
|
28
|
+
@new_language = FactoryGirl.create(:language)
|
29
|
+
session[:language_code] = @new_language.code
|
30
|
+
session[:language_id] = @new_language.id
|
31
|
+
post :copy_language_tree, {:languages => {:new_lang_id => @new_language.id, :old_lang_id => @language.id}}
|
32
|
+
@new_lang_root = Alchemy::Page.language_root_for(@new_language.id)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should copy all pages" do
|
36
|
+
@new_lang_root.should_not be_nil
|
37
|
+
@new_lang_root.descendants.count.should == 4
|
38
|
+
@new_lang_root.descendants.collect(&:name).should == ["Level 1 (Copy)", "Level 2 (Copy)", "Level 3 (Copy)", "Level 4 (Copy)"]
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should not set layoutpage attribute to nil" do
|
42
|
+
@new_lang_root.layoutpage.should_not be_nil
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should not set layoutpage attribute to true" do
|
46
|
+
@new_lang_root.layoutpage.should_not be_true
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
19
51
|
end
|
@@ -6,12 +6,12 @@ describe Alchemy::Admin::TrashController do
|
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
activate_authlogic
|
9
|
-
Alchemy::UserSession.create
|
9
|
+
Alchemy::UserSession.create FactoryGirl.create(:admin_user)
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should hold trashed elements" do
|
13
|
-
@page =
|
14
|
-
@element =
|
13
|
+
@page = FactoryGirl.create(:page, :parent_id => Alchemy::Page.rootpage.id)
|
14
|
+
@element = FactoryGirl.create(:element, :page => nil, :public => false, :position => 0, :folded => true)
|
15
15
|
get :index, :page_id => @page.id
|
16
16
|
response.body.should have_selector("#trash_items #element_#{@element.id}.element_editor")
|
17
17
|
end
|
@@ -11,14 +11,14 @@ describe Alchemy::BaseController do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should set the language from code" do
|
14
|
-
@language =
|
14
|
+
@language = FactoryGirl.create(:language, :code => 'kl')
|
15
15
|
controller.send :set_language_from, "kl"
|
16
16
|
controller.session[:language_id].should == @language.id
|
17
17
|
controller.session[:language_code].should == @language.code
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should set the language from id as string" do
|
21
|
-
@language =
|
21
|
+
@language = FactoryGirl.create(:language)
|
22
22
|
controller.send :set_language_from, @language.id.to_s
|
23
23
|
controller.session[:language_id].should == @language.id
|
24
24
|
controller.session[:language_code].should == @language.code
|
@@ -42,7 +42,7 @@ describe Alchemy::BaseController do
|
|
42
42
|
context "with lang param" do
|
43
43
|
|
44
44
|
it "should set the language" do
|
45
|
-
@language =
|
45
|
+
@language = FactoryGirl.create(:language)
|
46
46
|
controller.stub!(:params).and_return({:lang => 'kl'})
|
47
47
|
controller.send :set_language
|
48
48
|
controller.session[:language_id].should == @language.id
|