alchemy_cms 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/alchemy_cms.gemspec CHANGED
@@ -38,7 +38,7 @@ POST_INSTALL
38
38
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
39
39
  s.require_paths = ["lib"]
40
40
 
41
- s.add_runtime_dependency %q<rails>, ["~> 3.2.8"]
41
+ s.add_runtime_dependency %q<rails>, ["~> 3.2.11"]
42
42
  s.add_runtime_dependency %q<authlogic>, ["~> 3.1.3"]
43
43
  s.add_runtime_dependency %q<awesome_nested_set>, ["~> 2.0"]
44
44
  s.add_runtime_dependency %q<acts-as-taggable-on>, ["~> 2.1"]
@@ -60,7 +60,7 @@ POST_INSTALL
60
60
  s.add_development_dependency %q<bumpy>
61
61
  s.add_development_dependency %q<capybara>
62
62
  s.add_development_dependency %q<factory_girl_rails>
63
- s.add_development_dependency %q<rspec-rails>
63
+ s.add_development_dependency %q<rspec-rails>, ['2.12.0']
64
64
  s.add_development_dependency %q<sqlite3>
65
65
  s.add_development_dependency %q<yard>
66
66
 
@@ -60,8 +60,6 @@ module Alchemy
60
60
  session[:current_locale] = ::I18n.locale = params[:locale]
61
61
  elsif current_user && current_user.language.present?
62
62
  ::I18n.locale = current_user.language
63
- elsif Rails.env == 'test' # OMG I hate to do this. But it helps...
64
- ::I18n.locale = 'en'
65
63
  else
66
64
  ::I18n.locale = request.env['HTTP_ACCEPT_LANGUAGE'].try(:scan, /^[a-z]{2}/).try(:first)
67
65
  end
@@ -1,4 +1,5 @@
1
1
  require 'fileutils'
2
+ require 'active_record'
2
3
 
3
4
  module Alchemy
4
5
  class Upgrader < Alchemy::Seeder
@@ -114,8 +115,8 @@ module Alchemy
114
115
  def strip_alchemy_from_schema_version_table
115
116
  desc "Strip -alchemy suffix from schema_version table."
116
117
  database_yml = YAML.load_file(Rails.root.join("config", "database.yml"))
117
- connection = Mysql2::Client.new(database_yml.fetch(Rails.env.to_s).symbolize_keys)
118
- connection.query "UPDATE schema_migrations SET `schema_migrations`.`version` = REPLACE(`schema_migrations`.`version`,'-alchemy','')"
118
+ adapter = ActiveRecord::Base.establish_connection(database_yml.fetch(Rails.env.to_s).symbolize_keys)
119
+ adapter.connection.update("UPDATE schema_migrations SET version = REPLACE(`schema_migrations`.`version`,'-alchemy','')")
119
120
  end
120
121
 
121
122
  def convert_essence_texts_displayed_as_select_into_essence_selects
@@ -1,6 +1,6 @@
1
1
  module Alchemy
2
2
 
3
- VERSION = "2.4.0"
3
+ VERSION = "2.4.1"
4
4
 
5
5
  def self.version
6
6
  VERSION
@@ -37,7 +37,7 @@ module Dummy
37
37
 
38
38
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
39
39
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
40
- # config.i18n.default_locale = :de
40
+ config.i18n.default_locale = :en
41
41
 
42
42
  # Configure the default encoding used in templates for Ruby 1.9.
43
43
  config.encoding = "utf-8"
data/spec/factories.rb CHANGED
@@ -5,6 +5,7 @@ FactoryGirl.define do
5
5
  login "jdoe"
6
6
  password 's3cr3t'
7
7
  password_confirmation 's3cr3t'
8
+ language 'en'
8
9
 
9
10
  factory :admin_user do
10
11
  role "admin"
@@ -12,7 +12,7 @@ describe Alchemy::Admin::ElementsHelper do
12
12
  end
13
13
 
14
14
  it "should render an element editor partial" do
15
- helper.render_editor(@element).should match(/class="content_editor".+id="essence_text_\d{1,}"/)
15
+ helper.render_editor(@element).should match(/class="essence_text content_editor".+id="essence_text_\d{1,}"/)
16
16
  end
17
17
 
18
18
  it "should render a picture gallery editor partial" do
@@ -4,33 +4,34 @@ describe "Translation integration" do
4
4
 
5
5
  context "in admin backend" do
6
6
 
7
- before do
8
- authorize_as_admin
9
- end
10
-
11
7
  it "should be possible to set the locale of the admin backend via params" do
8
+ authorize_as_admin
12
9
  visit admin_dashboard_path(:locale => :de)
13
10
  page.should have_content('Willkommen')
14
11
  end
15
12
 
16
13
  it "should store the current locale in the session" do
14
+ authorize_as_admin
17
15
  visit admin_dashboard_path(:locale => :de)
18
16
  visit admin_dashboard_path
19
17
  page.should have_content('Willkommen')
20
18
  end
21
19
 
22
20
  it "should be possible to change the current locale in the session" do
21
+ authorize_as_admin
23
22
  visit admin_dashboard_path(:locale => :de)
24
23
  visit admin_dashboard_path(:locale => :en)
25
24
  page.should have_content('Welcome')
26
25
  end
27
26
 
28
27
  it "should not be possible to switch the locale of the admin backend to an unknown locale" do
28
+ authorize_as_admin
29
29
  visit admin_dashboard_path(:locale => :ko)
30
30
  page.should have_content('Welcome')
31
31
  end
32
32
 
33
33
  it "should use the current users language setting if no other parameter is given" do
34
+ authorize_as_admin(locale = nil)
34
35
  Alchemy::User.first.update_attributes(:language => :de)
35
36
  visit admin_dashboard_path
36
37
  page.should have_content('Willkommen')
@@ -38,4 +39,17 @@ describe "Translation integration" do
38
39
 
39
40
  end
40
41
 
42
+ context "with translated header" do
43
+
44
+ before do
45
+ Capybara.current_driver = :rack_test_translated_header
46
+ end
47
+
48
+ it "should use the browsers language setting if no other parameter is given" do
49
+ visit root_path
50
+ ::I18n.locale.should == :de
51
+ end
52
+
53
+ end
54
+
41
55
  end
data/spec/routing_spec.rb CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe "The Routing", :type => :routing do
4
4
 
5
- before(:each) { @routes = Alchemy::Engine.routes }
5
+ before { @routes = Alchemy::Engine.routes }
6
6
 
7
7
  context "for downloads" do
8
8
 
@@ -10,44 +10,44 @@ describe "The Routing", :type => :routing do
10
10
  {
11
11
  :get => "/attachment/32/download/Presseveranstaltung.pdf"
12
12
  }.should route_to(
13
- :controller => "alchemy/attachments",
14
- :action => "download",
15
- :id => "32",
16
- :name => "Presseveranstaltung",
17
- :format => "pdf"
18
- )
13
+ :controller => "alchemy/attachments",
14
+ :action => "download",
15
+ :id => "32",
16
+ :name => "Presseveranstaltung",
17
+ :format => "pdf"
18
+ )
19
19
  end
20
20
 
21
21
  it "should have a route for legacy Alchemy 1.x downloads" do
22
22
  {
23
23
  :get => "/attachment/32/download?name=Presseveranstaltung.pdf"
24
24
  }.should route_to(
25
- :controller => "alchemy/attachments",
26
- :action => "download",
27
- :id => "32"
28
- )
25
+ :controller => "alchemy/attachments",
26
+ :action => "download",
27
+ :id => "32"
28
+ )
29
29
  end
30
30
 
31
31
  it "should have a route for legacy washAPP downloads" do
32
32
  {
33
33
  :get => "/wa_files/download/11"
34
34
  }.should route_to(
35
- :controller => "alchemy/attachments",
36
- :action => "download",
37
- :id => "11"
38
- )
35
+ :controller => "alchemy/attachments",
36
+ :action => "download",
37
+ :id => "11"
38
+ )
39
39
  end
40
40
 
41
41
  it "should have a route for legacy WebMate downloads" do
42
42
  {
43
43
  :get => "/uploads/files/0000/0028/Pressetext.pdf"
44
44
  }.should route_to(
45
- :controller => "alchemy/attachments",
46
- :action => "download",
47
- :id => "0028",
48
- :name => "Pressetext",
49
- :suffix => "pdf"
50
- )
45
+ :controller => "alchemy/attachments",
46
+ :action => "download",
47
+ :id => "0028",
48
+ :name => "Pressetext",
49
+ :suffix => "pdf"
50
+ )
51
51
  end
52
52
 
53
53
  end
@@ -60,11 +60,11 @@ describe "The Routing", :type => :routing do
60
60
  {
61
61
  :get => "/products/my-product"
62
62
  }.should route_to(
63
- :controller => "alchemy/pages",
64
- :action => "show",
65
- :level1 => "products",
66
- :urlname => "my-product"
67
- )
63
+ :controller => "alchemy/pages",
64
+ :action => "show",
65
+ :level1 => "products",
66
+ :urlname => "my-product"
67
+ )
68
68
  end
69
69
 
70
70
  context "and language" do
@@ -73,12 +73,12 @@ describe "The Routing", :type => :routing do
73
73
  {
74
74
  :get => "/de/products/my-product"
75
75
  }.should route_to(
76
- :controller => "alchemy/pages",
77
- :action => "show",
78
- :level1 => "products",
79
- :urlname => "my-product",
80
- :lang => "de"
81
- )
76
+ :controller => "alchemy/pages",
77
+ :action => "show",
78
+ :level1 => "products",
79
+ :urlname => "my-product",
80
+ :lang => "de"
81
+ )
82
82
  end
83
83
 
84
84
  end
@@ -91,12 +91,12 @@ describe "The Routing", :type => :routing do
91
91
  {
92
92
  :get => "/catalog/products/my-product"
93
93
  }.should route_to(
94
- :controller => "alchemy/pages",
95
- :action => "show",
96
- :level1 => "catalog",
97
- :level2 => "products",
98
- :urlname => "my-product"
99
- )
94
+ :controller => "alchemy/pages",
95
+ :action => "show",
96
+ :level1 => "catalog",
97
+ :level2 => "products",
98
+ :urlname => "my-product"
99
+ )
100
100
  end
101
101
 
102
102
  context "and language" do
@@ -105,13 +105,13 @@ describe "The Routing", :type => :routing do
105
105
  {
106
106
  :get => "/de/catalog/products/my-product"
107
107
  }.should route_to(
108
- :controller => "alchemy/pages",
109
- :action => "show",
110
- :level1 => "catalog",
111
- :level2 => "products",
112
- :urlname => "my-product",
113
- :lang => "de"
114
- )
108
+ :controller => "alchemy/pages",
109
+ :action => "show",
110
+ :level1 => "catalog",
111
+ :level2 => "products",
112
+ :urlname => "my-product",
113
+ :lang => "de"
114
+ )
115
115
  end
116
116
 
117
117
  end
@@ -124,13 +124,13 @@ describe "The Routing", :type => :routing do
124
124
  {
125
125
  :get => "/2011/12/08/my-post"
126
126
  }.should route_to(
127
- :controller => "alchemy/pages",
128
- :action => "show",
129
- :level1 => "2011",
130
- :level2 => "12",
131
- :level3 => "08",
132
- :urlname => "my-post"
133
- )
127
+ :controller => "alchemy/pages",
128
+ :action => "show",
129
+ :level1 => "2011",
130
+ :level2 => "12",
131
+ :level3 => "08",
132
+ :urlname => "my-post"
133
+ )
134
134
  end
135
135
 
136
136
  context "and language" do
@@ -139,14 +139,14 @@ describe "The Routing", :type => :routing do
139
139
  {
140
140
  :get => "/de/2011/12/08/my-post"
141
141
  }.should route_to(
142
- :controller => "alchemy/pages",
143
- :action => "show",
144
- :level1 => "2011",
145
- :level2 => "12",
146
- :level3 => "08",
147
- :urlname => "my-post",
148
- :lang => "de"
149
- )
142
+ :controller => "alchemy/pages",
143
+ :action => "show",
144
+ :level1 => "2011",
145
+ :level2 => "12",
146
+ :level3 => "08",
147
+ :urlname => "my-post",
148
+ :lang => "de"
149
+ )
150
150
  end
151
151
 
152
152
  end
@@ -161,97 +161,97 @@ describe "The Routing", :type => :routing do
161
161
  {
162
162
  :get => "/pictures/3/show/900x300/kitten.jpg"
163
163
  }.should route_to(
164
- :controller => "alchemy/pictures",
165
- :action => "show",
166
- :id => "3",
167
- :size => "900x300",
168
- :name => "kitten",
169
- :format => "jpg"
170
- )
164
+ :controller => "alchemy/pictures",
165
+ :action => "show",
166
+ :id => "3",
167
+ :size => "900x300",
168
+ :name => "kitten",
169
+ :format => "jpg"
170
+ )
171
171
  end
172
172
 
173
173
  it "should route to cropped show action" do
174
174
  {
175
175
  :get => "/pictures/3/show/900x300/crop/kitten.jpg"
176
176
  }.should route_to(
177
- :controller => "alchemy/pictures",
178
- :action => "show",
179
- :id => "3",
180
- :size => "900x300",
181
- :crop => "crop",
182
- :name => "kitten",
183
- :format => "jpg"
184
- )
177
+ :controller => "alchemy/pictures",
178
+ :action => "show",
179
+ :id => "3",
180
+ :size => "900x300",
181
+ :crop => "crop",
182
+ :name => "kitten",
183
+ :format => "jpg"
184
+ )
185
185
  end
186
186
 
187
187
  it "should route to cropped mask show action" do
188
188
  get(
189
189
  "/pictures/3/show/300x300/crop/200x50/100x100/kitten.jpg"
190
190
  ).should route_to(
191
- :controller => "alchemy/pictures",
192
- :action => "show",
193
- :id => "3",
194
- :size => "300x300",
195
- :crop => "crop",
196
- :crop_from => "200x50",
197
- :crop_size => "100x100",
198
- :name => "kitten",
199
- :format => "jpg"
200
- )
191
+ :controller => "alchemy/pictures",
192
+ :action => "show",
193
+ :id => "3",
194
+ :size => "300x300",
195
+ :crop => "crop",
196
+ :crop_from => "200x50",
197
+ :crop_size => "100x100",
198
+ :name => "kitten",
199
+ :format => "jpg"
200
+ )
201
201
  end
202
202
 
203
203
  it "should route to thumbnail action" do
204
204
  get(
205
205
  "/pictures/3/thumbnails/small/kitten.jpg"
206
206
  ).should route_to(
207
- :controller => "alchemy/pictures",
208
- :action => "thumbnail",
209
- :id => "3",
210
- :size => "small",
211
- :name => "kitten",
212
- :format => "jpg"
213
- )
207
+ :controller => "alchemy/pictures",
208
+ :action => "thumbnail",
209
+ :id => "3",
210
+ :size => "small",
211
+ :name => "kitten",
212
+ :format => "jpg"
213
+ )
214
214
  end
215
215
 
216
216
  it "should route to cropped thumbnail action" do
217
217
  get(
218
218
  "/pictures/3/thumbnails/small/crop/kitten.jpg"
219
219
  ).should route_to(
220
- :controller => "alchemy/pictures",
221
- :action => "thumbnail",
222
- :id => "3",
223
- :crop => "crop",
224
- :size => "small",
225
- :name => "kitten",
226
- :format => "jpg"
227
- )
220
+ :controller => "alchemy/pictures",
221
+ :action => "thumbnail",
222
+ :id => "3",
223
+ :crop => "crop",
224
+ :size => "small",
225
+ :name => "kitten",
226
+ :format => "jpg"
227
+ )
228
228
  end
229
229
 
230
230
  it "should route to cropped and masked thumbnail" do
231
231
  get(
232
232
  "/pictures/3/thumbnails/small/0x0/200x200/kitten.jpg"
233
233
  ).should route_to(
234
- :controller => "alchemy/pictures",
235
- :action => "thumbnail",
236
- :id => "3",
237
- :crop_from => "0x0",
238
- :crop_size => "200x200",
239
- :size => "small",
240
- :name => "kitten",
241
- :format => "jpg"
242
- )
234
+ :controller => "alchemy/pictures",
235
+ :action => "thumbnail",
236
+ :id => "3",
237
+ :crop_from => "0x0",
238
+ :crop_size => "200x200",
239
+ :size => "small",
240
+ :name => "kitten",
241
+ :format => "jpg"
242
+ )
243
243
  end
244
244
 
245
245
  it "should route to zoomed picture" do
246
246
  get(
247
247
  "/pictures/3/zoom/kitten.jpg"
248
248
  ).should route_to(
249
- :controller => "alchemy/pictures",
250
- :action => "zoom",
251
- :id => "3",
252
- :name => "kitten",
253
- :format => "jpg"
254
- )
249
+ :controller => "alchemy/pictures",
250
+ :action => "zoom",
251
+ :id => "3",
252
+ :name => "kitten",
253
+ :format => "jpg"
254
+ )
255
255
  end
256
256
 
257
257
  end
data/spec/spec_helper.rb CHANGED
@@ -39,6 +39,9 @@ def configure
39
39
  Capybara.default_driver = :rack_test
40
40
  Capybara.default_selector = :css
41
41
  Capybara.javascript_driver = :poltergeist
42
+ Capybara.register_driver(:rack_test_translated_header) do |app|
43
+ Capybara::RackTest::Driver.new(app, :headers => { 'HTTP_ACCEPT_LANGUAGE' => 'de' })
44
+ end
42
45
 
43
46
  # Load support files
44
47
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
@@ -15,9 +15,9 @@ module Alchemy
15
15
  # * create_admin_user
16
16
  # * login_into_alchemy
17
17
  #
18
- def authorize_as_admin
18
+ def authorize_as_admin(locale = 'en')
19
19
  create_admin_user
20
- login_into_alchemy
20
+ login_into_alchemy(locale)
21
21
  end
22
22
 
23
23
  # Capybara actions to login into Alchemy Backend
@@ -26,8 +26,8 @@ module Alchemy
26
26
  #
27
27
  # See: create_admin_user method
28
28
  #
29
- def login_into_alchemy
30
- visit '/alchemy/admin/login'
29
+ def login_into_alchemy(locale = 'en')
30
+ visit "/alchemy/admin/login?locale=#{locale}"
31
31
  fill_in('alchemy_user_session_login', :with => 'jdoe')
32
32
  fill_in('alchemy_user_session_password', :with => 's3cr3t')
33
33
  click_on('Login')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2012-12-01 00:00:00.000000000 Z
16
+ date: 2013-01-10 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rails
@@ -22,7 +22,7 @@ dependencies:
22
22
  requirements:
23
23
  - - ~>
24
24
  - !ruby/object:Gem::Version
25
- version: 3.2.8
25
+ version: 3.2.11
26
26
  type: :runtime
27
27
  prerelease: false
28
28
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 3.2.8
33
+ version: 3.2.11
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: authlogic
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -356,17 +356,17 @@ dependencies:
356
356
  requirement: !ruby/object:Gem::Requirement
357
357
  none: false
358
358
  requirements:
359
- - - ! '>='
359
+ - - '='
360
360
  - !ruby/object:Gem::Version
361
- version: '0'
361
+ version: 2.12.0
362
362
  type: :development
363
363
  prerelease: false
364
364
  version_requirements: !ruby/object:Gem::Requirement
365
365
  none: false
366
366
  requirements:
367
- - - ! '>='
367
+ - - '='
368
368
  - !ruby/object:Gem::Version
369
- version: '0'
369
+ version: 2.12.0
370
370
  - !ruby/object:Gem::Dependency
371
371
  name: sqlite3
372
372
  requirement: !ruby/object:Gem::Requirement
@@ -1100,7 +1100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1100
1100
  version: '0'
1101
1101
  segments:
1102
1102
  - 0
1103
- hash: 3242922462543667303
1103
+ hash: 1834932849568995813
1104
1104
  requirements:
1105
1105
  - ImageMagick (libmagick), v6.6 or greater.
1106
1106
  rubyforge_project: