alchemy_cms 3.0.0.rc7 → 3.0.0.rc8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/README.md +1 -1
  4. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +0 -2
  5. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +1 -1
  6. data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +26 -2
  7. data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +1 -1
  8. data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +22 -0
  9. data/app/assets/stylesheets/alchemy/base.scss +1 -5
  10. data/app/assets/stylesheets/alchemy/elements.scss +11 -61
  11. data/app/assets/stylesheets/alchemy/frame.scss +1 -1
  12. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +1 -1
  13. data/app/controllers/alchemy/admin/attachments_controller.rb +1 -1
  14. data/app/controllers/alchemy/admin/base_controller.rb +7 -13
  15. data/app/controllers/alchemy/admin/clipboard_controller.rb +15 -10
  16. data/app/controllers/alchemy/admin/elements_controller.rb +15 -11
  17. data/app/controllers/alchemy/admin/essence_pictures_controller.rb +8 -1
  18. data/app/controllers/alchemy/admin/pages_controller.rb +95 -22
  19. data/app/controllers/alchemy/admin/tags_controller.rb +1 -1
  20. data/app/controllers/alchemy/pictures_controller.rb +33 -32
  21. data/app/helpers/alchemy/admin/base_helper.rb +3 -16
  22. data/app/models/alchemy/element.rb +1 -1
  23. data/app/models/alchemy/page/page_naming.rb +4 -2
  24. data/app/models/alchemy/page/page_natures.rb +1 -1
  25. data/app/models/alchemy/page.rb +20 -1
  26. data/app/models/alchemy/picture.rb +1 -0
  27. data/app/models/alchemy/tree_node.rb +4 -0
  28. data/app/views/alchemy/admin/contents/destroy.js.erb +4 -0
  29. data/app/views/alchemy/admin/dashboard/index.html.erb +1 -1
  30. data/app/views/alchemy/admin/elements/_element.html.erb +11 -12
  31. data/app/views/alchemy/admin/elements/_new_element_form.html.erb +0 -3
  32. data/app/views/alchemy/admin/elements/create.js.erb +3 -3
  33. data/app/views/alchemy/admin/elements/index.html.erb +4 -19
  34. data/app/views/alchemy/admin/elements/new.html.erb +0 -3
  35. data/app/views/alchemy/admin/elements/trash.js.erb +12 -16
  36. data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
  37. data/app/views/alchemy/admin/pages/edit.html.erb +36 -30
  38. data/app/views/alchemy/admin/pictures/edit_multiple.html.erb +1 -1
  39. data/app/views/alchemy/admin/trash/clear.js.erb +4 -0
  40. data/config/locales/alchemy.de.yml +56 -84
  41. data/config/locales/alchemy.en.yml +326 -105
  42. data/config/locales/alchemy.fr.yml +942 -0
  43. data/config/locales/alchemy.nl.yml +111 -137
  44. data/config/locales/simple_form.fr.yml +26 -0
  45. data/lib/alchemy/engine.rb +7 -1
  46. data/lib/alchemy/i18n.rb +7 -1
  47. data/lib/alchemy/middleware/rescue_old_cookies.rb +27 -0
  48. data/lib/alchemy/permissions.rb +1 -1
  49. data/lib/alchemy/version.rb +1 -1
  50. data/spec/controllers/admin/clipboard_controller_spec.rb +16 -19
  51. data/spec/controllers/admin/elements_controller_spec.rb +20 -23
  52. data/spec/controllers/admin/essence_pictures_controller_spec.rb +22 -6
  53. data/spec/controllers/admin/pages_controller_spec.rb +94 -5
  54. data/spec/controllers/pictures_controller_spec.rb +44 -3
  55. data/spec/features/admin/link_overlay_spec.rb +1 -0
  56. data/spec/features/admin/locale_select_feature_spec.rb +22 -0
  57. data/spec/libraries/i18n_spec.rb +30 -0
  58. data/spec/libraries/permissions_spec.rb +1 -1
  59. data/spec/models/element_spec.rb +5 -4
  60. data/spec/models/page_spec.rb +137 -8
  61. data/spec/spec_helper.rb +23 -19
  62. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.nestedSortable.js +9 -3
  63. metadata +12 -10
  64. data/app/models/alchemy/clipboard.rb +0 -74
  65. data/app/views/alchemy/admin/contents/destroy.js.coffee +0 -4
  66. data/app/views/alchemy/admin/elements/_add_element_button.html.erb +0 -18
  67. data/app/views/alchemy/admin/trash/clear.js.coffee +0 -4
  68. data/spec/models/clipboard_spec.rb +0 -111
  69. data/spec/support/phantomjs_mavericks_fix.rb +0 -32
@@ -0,0 +1,26 @@
1
+ fr:
2
+ simple_form:
3
+ "yes": 'oui'
4
+ "no": 'non'
5
+ required:
6
+ text: 'champ obligatoire'
7
+ mark: '*'
8
+ # You can uncomment the line below if you need to overwrite the whole required html.
9
+ # When using html, text and mark won't be used.
10
+ # html: '<abbr title="required">*</abbr>'
11
+ error_notification:
12
+ default_message: "Il ya des erreurs:"
13
+ # Labels and hints examples
14
+ # labels:
15
+ # defaults:
16
+ # password: 'Password'
17
+ # user:
18
+ # new:
19
+ # email: 'E-mail to sign in.'
20
+ # edit:
21
+ # email: 'E-mail.'
22
+ # hints:
23
+ # defaults:
24
+ # username: 'User name to sign in.'
25
+ # password: 'No special characters, please.'
26
+
@@ -6,7 +6,6 @@ require 'action_view/dependency_tracker'
6
6
  require 'active_model_serializers'
7
7
  require 'awesome_nested_set'
8
8
  require 'cancan'
9
- require 'coffee-rails'
10
9
  require 'compass-rails'
11
10
  require 'dragonfly'
12
11
  require 'jquery-rails'
@@ -47,6 +46,9 @@ require_relative './touching'
47
46
  require_relative './kaminari/scoped_pagination_url_helper'
48
47
  require_relative '../extensions/action_view'
49
48
 
49
+ # Middleware
50
+ require_relative './middleware/rescue_old_cookies'
51
+
50
52
  module Alchemy
51
53
  class Engine < Rails::Engine
52
54
  isolate_namespace Alchemy
@@ -66,6 +68,10 @@ module Alchemy
66
68
  ]
67
69
  end
68
70
 
71
+ initializer 'alchemy.middleware.rescue_old_cookies' do |app|
72
+ app.middleware.insert_before(ActionDispatch::Cookies, Alchemy::Middleware::RescueOldCookies)
73
+ end
74
+
69
75
  initializer 'alchemy.dependency_tracker' do |app|
70
76
  [:erb, :slim, :haml].each do |handler|
71
77
  ActionView::DependencyTracker.register_tracker(handler, CacheDigests::TemplateTracker)
data/lib/alchemy/i18n.rb CHANGED
@@ -45,7 +45,13 @@ module Alchemy
45
45
  end
46
46
 
47
47
  def self.available_locales
48
- translation_files.collect { |f| f.match(/.{2}\.yml$/).to_s.gsub(/\.yml/, '') }
48
+ @@available_locales ||= nil
49
+ @@available_locales || translation_files.collect { |f| f.match(/.{2}\.yml$/).to_s.gsub(/\.yml/, '').to_sym }
50
+ end
51
+
52
+ def self.available_locales=(locales)
53
+ @@available_locales = Array(locales).map { |locale| locale.to_sym }
54
+ @@available_locales = nil if @@available_locales.empty?
49
55
  end
50
56
 
51
57
  def self.translation_files
@@ -0,0 +1,27 @@
1
+ module Alchemy
2
+ module Middleware
3
+ class RescueOldCookies
4
+ def initialize(app)
5
+ @app = app
6
+ end
7
+
8
+ def call(env)
9
+ begin
10
+ @app.call(env)
11
+ rescue NameError => error
12
+ if error.to_s =~ /uninitialized constant Alchemy::Clipboard/
13
+ message = "<h2>You have an old style Alchemy clipboard in your session!</h2>"
14
+ message += "<h3>Please remove your cookies and try again.</h3>"
15
+ Rails.logger.error(error)
16
+ return [
17
+ 500, { "Content-Type" => "text/html" },
18
+ [message]
19
+ ]
20
+ else
21
+ raise error
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -86,12 +86,12 @@ module Alchemy
86
86
 
87
87
  # Controller actions
88
88
  can [:info, :help], :alchemy_admin_dashboard
89
+ can :manage, :alchemy_admin_clipboard
89
90
  can :index, :trash
90
91
  can :edit, :alchemy_admin_layoutpages
91
92
 
92
93
  # Resources
93
94
  can [:read, :download], Alchemy::Attachment
94
- can :manage, Alchemy::Clipboard
95
95
  can :manage, Alchemy::Content
96
96
  can :manage, Alchemy::Element
97
97
  can :manage, Alchemy::EssenceFile
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
- VERSION = "3.0.0.rc7"
2
+ VERSION = "3.0.0.rc8"
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -8,51 +8,48 @@ module Alchemy
8
8
 
9
9
  before do
10
10
  sign_in(admin_user)
11
- session[:clipboard] = Clipboard.new
11
+ session[:alchemy_clipboard] = {}
12
12
  Element.stub(find: element)
13
13
  end
14
14
 
15
15
  describe "#insert" do
16
16
  it "should hold element ids" do
17
- xhr :post, :insert, {remarkable_type: :elements, remarkable_id: element.id}
18
- session[:clipboard][:elements].should == [{id: element.id, action: 'copy'}]
17
+ xhr :post, :insert, {remarkable_type: 'elements', remarkable_id: element.id}
18
+ session[:alchemy_clipboard]['elements'].should == [{'id' => element.id.to_s, 'action' => 'copy'}]
19
19
  end
20
20
 
21
21
  it "should not have the same element twice" do
22
- session[:clipboard][:elements] = {id: element.id, action: 'copy'}
23
- xhr :post, :insert, {remarkable_type: :elements, remarkable_id: element.id}
24
- session[:clipboard][:elements].collect { |e| e[:id] }.should_not == [element.id, element.id]
22
+ session[:alchemy_clipboard]['elements'] = [{'id' => element.id.to_s, 'action' => 'copy'}]
23
+ xhr :post, :insert, {remarkable_type: 'elements', remarkable_id: element.id}
24
+ session[:alchemy_clipboard]['elements'].collect { |e| e['id'] }.should_not == [element.id, element.id]
25
25
  end
26
26
  end
27
27
 
28
28
  describe "#delete" do
29
29
  it "should remove element ids from clipboard" do
30
- session[:clipboard][:elements] = {id: element.id, action: 'copy'}
31
- session[:clipboard][:elements] << {id: another_element.id, action: 'copy'}
32
- xhr :delete, :remove, {remarkable_type: :elements, remarkable_id: another_element.id}
33
- session[:clipboard][:elements].should == [{id: element.id, action: 'copy'}]
30
+ session[:alchemy_clipboard]['elements'] = [{'id' => element.id.to_s, 'action' => 'copy'}]
31
+ session[:alchemy_clipboard]['elements'] << {'id' => another_element.id.to_s, 'action' => 'copy'}
32
+ xhr :delete, :remove, {remarkable_type: 'elements', remarkable_id: another_element.id}
33
+ session[:alchemy_clipboard]['elements'].should == [{'id' => element.id.to_s, 'action' => 'copy'}]
34
34
  end
35
35
  end
36
36
 
37
37
  describe "#clear" do
38
-
39
38
  context "with elements as remarkable_type" do
40
39
  it "should clear the elements clipboard" do
41
- session[:clipboard][:elements] = {id: element.id}
42
- xhr :delete, :clear, {remarkable_type: :elements}
43
- session[:clipboard].should be_empty
40
+ session[:alchemy_clipboard]['elements'] = [{'id' => element.id.to_s}]
41
+ xhr :delete, :clear, {remarkable_type: 'elements'}
42
+ session[:alchemy_clipboard]['elements'].should be_empty
44
43
  end
45
44
  end
46
45
 
47
46
  context "with pages as remarkable_type" do
48
47
  it "should clear the pages clipboard" do
49
- session[:clipboard][:pages] = {id: public_page.id}
50
- xhr :delete, :clear, {remarkable_type: :pages}
51
- session[:clipboard].should be_empty
48
+ session[:alchemy_clipboard]['pages'] = [{'id' => public_page.id.to_s}]
49
+ xhr :delete, :clear, {remarkable_type: 'pages'}
50
+ session[:alchemy_clipboard]['pages'].should be_empty
52
51
  end
53
52
  end
54
-
55
53
  end
56
-
57
54
  end
58
55
  end
@@ -5,7 +5,7 @@ module Alchemy
5
5
  let(:alchemy_page) { create(:page) }
6
6
  let(:element) { create(:element, :page_id => alchemy_page.id) }
7
7
  let(:element_in_clipboard) { create(:element, :page_id => alchemy_page.id) }
8
- let(:clipboard) { session[:clipboard] = Clipboard.new }
8
+ let(:clipboard) { session[:alchemy_clipboard] = {} }
9
9
 
10
10
  before { sign_in(author_user) }
11
11
 
@@ -80,9 +80,9 @@ module Alchemy
80
80
  end
81
81
 
82
82
  context "with elements in clipboard" do
83
- let(:clipboard_items) { [{:id => element.id, :action => 'copy'}] }
83
+ let(:clipboard_items) { [{'id' => element.id.to_s, 'action' => 'copy'}] }
84
84
 
85
- before { clipboard[:elements] = clipboard_items }
85
+ before { clipboard['elements'] = clipboard_items }
86
86
 
87
87
  it "should load all elements from clipboard" do
88
88
  Element.should_receive(:all_from_clipboard_for_page).and_return(clipboard_items)
@@ -96,28 +96,25 @@ module Alchemy
96
96
  describe 'insertion position' do
97
97
  before { element }
98
98
 
99
- context 'with no insert_after passed' do
100
- it "should insert the element at top of list" do
101
- xhr :post, :create, {element: {name: 'news', page_id: alchemy_page.id}}
102
- alchemy_page.elements.count.should == 2
103
- alchemy_page.elements.first.name.should == 'news'
104
- end
99
+ it "should insert the element at bottom of list" do
100
+ xhr :post, :create, {element: {name: 'news', page_id: alchemy_page.id}}
101
+ alchemy_page.elements.count.should == 2
102
+ alchemy_page.elements.last.name.should == 'news'
105
103
  end
106
104
 
107
- context "with insert_after passed in the params" do
108
- let(:element_before) { create(:element, name: 'headline', page: alchemy_page) }
109
-
105
+ context "on a page with a setting for insert_elements_at of top" do
110
106
  before do
111
- alchemy_page.elements.delete_all
112
- element_before
107
+ PageLayout.stub(:get).and_return({
108
+ 'name' => 'news',
109
+ 'elements' => ['news'],
110
+ 'insert_elements_at' => 'top'
111
+ })
113
112
  end
114
113
 
115
- it "should insert the new element after that element" do
116
- xhr :post, :create, {element: {name: 'news', page_id: alchemy_page.id}, insert_after: element_before.id}
114
+ it "should insert the element at top of list" do
115
+ xhr :post, :create, {element: {name: 'news', page_id: alchemy_page.id}}
117
116
  alchemy_page.elements.count.should == 2
118
- alchemy_page.elements.reload
119
- alchemy_page.elements.first.name.should == 'headline'
120
- alchemy_page.elements.last.name.should == 'news'
117
+ alchemy_page.elements.first.name.should == 'news'
121
118
  end
122
119
  end
123
120
  end
@@ -161,7 +158,7 @@ module Alchemy
161
158
  'cells' => ['header']
162
159
  })
163
160
  Cell.stub(:definition_for).and_return({'name' => 'header', 'elements' => ['article']})
164
- clipboard[:elements] = [{:id => element_in_clipboard.id}]
161
+ clipboard['elements'] = [{'id' => element_in_clipboard.id.to_s}]
165
162
  end
166
163
 
167
164
  context "and cell name in element name" do
@@ -202,7 +199,7 @@ module Alchemy
202
199
  'cells' => ['news']
203
200
  })
204
201
  Cell.stub(:definition_for).and_return({'name' => 'news', 'elements' => ['news']})
205
- clipboard[:elements] = [{:id => element_in_clipboard.id}]
202
+ clipboard['elements'] = [{'id' => element_in_clipboard.id.to_s}]
206
203
  cell.elements << element
207
204
  end
208
205
 
@@ -220,7 +217,7 @@ module Alchemy
220
217
  render_views
221
218
 
222
219
  before do
223
- clipboard[:elements] = [{id: element_in_clipboard.id, action: 'cut'}]
220
+ clipboard['elements'] = [{'id' => element_in_clipboard.id.to_s, 'action' => 'cut'}]
224
221
  end
225
222
 
226
223
  it "should create an element from clipboard" do
@@ -232,7 +229,7 @@ module Alchemy
232
229
  context "and with cut as action parameter" do
233
230
  it "should also remove the element id from clipboard" do
234
231
  xhr :post, :create, {paste_from_clipboard: element_in_clipboard.id, element: {page_id: alchemy_page.id}}
235
- session[:clipboard].contains?(:elements, element_in_clipboard.id).should_not be_true
232
+ session[:alchemy_clipboard]['elements'].detect { |item| item['id'] == element_in_clipboard.id.to_s }.should be_nil
236
233
  end
237
234
  end
238
235
  end
@@ -41,7 +41,7 @@ module Alchemy
41
41
  before do
42
42
  picture.image_file_width = 300
43
43
  picture.image_file_height = 250
44
- essence.should_receive(:picture).and_return(picture)
44
+ essence.should_receive(:picture).any_number_of_times.and_return(picture)
45
45
  end
46
46
 
47
47
  context 'with no render_size present in essence' do
@@ -67,14 +67,30 @@ module Alchemy
67
67
  end
68
68
 
69
69
  context 'with render_size present in essence' do
70
- before do
70
+ it "sets sizes from these values" do
71
71
  essence.stub(:render_size).and_return('30x25')
72
- end
73
72
 
74
- it "sets sizes from these values" do
75
73
  get :crop, id: 1
76
- expect(assigns(:size_x)).to eq('30')
77
- expect(assigns(:size_y)).to eq('25')
74
+ expect(assigns(:size_x)).to eq(30)
75
+ expect(assigns(:size_y)).to eq(25)
76
+ end
77
+
78
+ context 'when width or height is not fixed' do
79
+ it 'infers the height from the image file preserving the aspect ratio' do
80
+ essence.stub(:render_size).and_return('30')
81
+
82
+ get :crop, id: 1
83
+ expect(assigns(:size_x)).to eq(30)
84
+ expect(assigns(:size_y)).to eq(25)
85
+ end
86
+
87
+ it 'infers the height from the image file preserving the aspect ratio' do
88
+ essence.stub(:render_size).and_return('x25')
89
+
90
+ get :crop, id: 1
91
+ expect(assigns(:size_x)).to eq(30)
92
+ expect(assigns(:size_y)).to eq(25)
93
+ end
78
94
  end
79
95
  end
80
96
 
@@ -54,10 +54,10 @@ module Alchemy
54
54
 
55
55
  describe '#new' do
56
56
  context "pages in clipboard" do
57
- let(:clipboard) { session[:clipboard] = Clipboard.new }
57
+ let(:clipboard) { session[:alchemy_clipboard] = {} }
58
58
  let(:page) { mock_model(Alchemy::Page, name: 'Foobar') }
59
59
 
60
- before { clipboard[:pages] = [{id: page.id, action: 'copy'}] }
60
+ before { clipboard['pages'] = [{'id' => page.id.to_s, 'action' => 'copy'}] }
61
61
 
62
62
  it "should load all pages from clipboard" do
63
63
  xhr :get, :new, {page_id: page.id}
@@ -96,6 +96,95 @@ module Alchemy
96
96
  end
97
97
  end
98
98
 
99
+ describe '#order' do
100
+ let(:page_1) { FactoryGirl.create(:page, visible: true) }
101
+ let(:page_2) { FactoryGirl.create(:page, visible: true) }
102
+ let(:page_3) { FactoryGirl.create(:page, visible: true) }
103
+ let(:page_item_1) { {id: page_1.id, slug: page_1.slug, restricted: false, external: page_1.redirects_to_external?, visible: page_1.visible?, children: [page_item_2]} }
104
+ let(:page_item_2) { {id: page_2.id, slug: page_2.slug, restricted: false, external: page_2.redirects_to_external?, visible: page_2.visible?, children: [page_item_3]} }
105
+ let(:page_item_3) { {id: page_3.id, slug: page_3.slug, restricted: false, external: page_3.redirects_to_external?, visible: page_3.visible? } }
106
+ let(:set_of_pages) { [page_item_1] }
107
+
108
+ it "stores the new order" do
109
+ xhr :post, :order, set: set_of_pages.to_json
110
+ page_1.reload
111
+ expect(page_1.descendants).to eq([page_2, page_3])
112
+ end
113
+
114
+ context 'with url nesting enabled' do
115
+ before { Alchemy::Config.stub(get: true) }
116
+
117
+ it "updates the pages urlnames" do
118
+ xhr :post, :order, set: set_of_pages.to_json
119
+ [page_1, page_2, page_3].map(&:reload)
120
+ expect(page_1.urlname).to eq("#{page_1.slug}")
121
+ expect(page_2.urlname).to eq("#{page_1.slug}/#{page_2.slug}")
122
+ expect(page_3.urlname).to eq("#{page_1.slug}/#{page_2.slug}/#{page_3.slug}")
123
+ end
124
+
125
+ context 'with invisible page in tree' do
126
+ let(:page_item_2) do
127
+ {
128
+ id: page_2.id,
129
+ slug: page_2.slug,
130
+ children: [page_item_3],
131
+ visible: false
132
+ }
133
+ end
134
+
135
+ it "does not use this pages slug in urlnames of descendants" do
136
+ xhr :post, :order, set: set_of_pages.to_json
137
+ [page_1, page_2, page_3].map(&:reload)
138
+ expect(page_1.urlname).to eq("#{page_1.slug}")
139
+ expect(page_2.urlname).to eq("#{page_1.slug}/#{page_2.slug}")
140
+ expect(page_3.urlname).to eq("#{page_1.slug}/#{page_3.slug}")
141
+ end
142
+ end
143
+
144
+ context 'with external page in tree' do
145
+ let(:page_item_2) do
146
+ {
147
+ id: page_2.id,
148
+ slug: page_2.slug,
149
+ children: [page_item_3],
150
+ external: true
151
+ }
152
+ end
153
+
154
+ it "does not use this pages slug in urlnames of descendants" do
155
+ xhr :post, :order, set: set_of_pages.to_json
156
+ [page_1, page_2, page_3].map(&:reload)
157
+ expect(page_3.urlname).to eq("#{page_1.slug}/#{page_3.slug}")
158
+ end
159
+ end
160
+
161
+ context 'with restricted page in tree' do
162
+ let(:page_2) { FactoryGirl.create(:page, restricted: true) }
163
+ let(:page_item_2) do
164
+ {
165
+ id: page_2.id,
166
+ slug: page_2.slug,
167
+ children: [page_item_3],
168
+ restricted: true
169
+ }
170
+ end
171
+
172
+ it "updates restricted status of descendants" do
173
+ xhr :post, :order, set: set_of_pages.to_json
174
+ page_3.reload
175
+ expect(page_3.restricted).to be_true
176
+ end
177
+ end
178
+
179
+ it "creates legacy urls" do
180
+ xhr :post, :order, set: set_of_pages.to_json
181
+ [page_2, page_3].map(&:reload)
182
+ expect(page_2.legacy_urls.size).to eq(1)
183
+ expect(page_3.legacy_urls.size).to eq(1)
184
+ end
185
+ end
186
+ end
187
+
99
188
  describe "#configure" do
100
189
  render_views
101
190
 
@@ -289,14 +378,14 @@ module Alchemy
289
378
  end
290
379
 
291
380
  describe '#destroy' do
292
- let(:clipboard) { session[:clipboard] = Clipboard.new }
381
+ let(:clipboard) { session[:alchemy_clipboard] = {} }
293
382
  let(:page) { FactoryGirl.create(:public_page) }
294
383
 
295
- before { clipboard[:pages] = [{id: page.id}] }
384
+ before { clipboard['pages'] = [{'id' => page.id.to_s}] }
296
385
 
297
386
  it "should also remove the page from clipboard" do
298
387
  xhr :post, :destroy, {id: page.id, _method: :delete}
299
- clipboard[:pages].should be_empty
388
+ clipboard['pages'].should be_empty
300
389
  end
301
390
  end
302
391