alchemy_cms 2.8.1 → 2.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: edf3ac4fd7a2b98807ac909f6f091cdafb11f9c6
4
- data.tar.gz: 4515777e5e93ef98b427f57dd9fd5a9f4b59333f
3
+ metadata.gz: c340c7f6e2a90471d1b5772227b1498b37859249
4
+ data.tar.gz: 450b8d1a217f9deaecabab868405f5c4a9457df7
5
5
  SHA512:
6
- metadata.gz: a32052e6ccd970e0ba9f51e978d57897b67ffd0980425c283ddb1c01d27e5a8f71006d553867c6833420c33fc95802917987de9a599322fd1f44908e0e4d9455
7
- data.tar.gz: d8199c8dce2e4d9f52aa0d6da2eca587050a574ef6d67855fe28c484718a8cb4d19a5fba1848e39ff1163512a148fabf014bc5d5ebd1c0002e55f304459be1eb
6
+ metadata.gz: fa4fec08b37e3fe38aa3c3b0ddc10458007b1621299734c8ad8071849de679b0a08b5d33c0989198cff1321106c94be6cebe2560ceabb6ea721b5fb15c5750d2
7
+ data.tar.gz: adbccc24de430ef03733e08d179f2528f7cb947cdb363c17a8b66b6aa7dd5a0bd2e1961aedf205f249d74cc00d7f1f64c519395d2d733029dc3456b078232fd3
data/Gemfile CHANGED
@@ -14,6 +14,8 @@ gem 'sqlite3' if ENV['DB'].nil? || ENV['DB'] == 'sqlite'
14
14
  gem 'mysql2' if ENV['DB'] == 'mysql'
15
15
  gem 'pg' if ENV['DB'] == 'postgresql'
16
16
 
17
+ gem 'database_cleaner'
18
+
17
19
  unless ENV['CI']
18
20
  gem 'pry'
19
21
  gem 'quiet_assets' # Mute assets loggin
@@ -23,7 +25,6 @@ end
23
25
  group :test do
24
26
  unless ENV['FAST_SPECS']
25
27
  gem 'poltergeist'
26
- gem 'connection_pool' # https://gist.github.com/mperham/3049152
27
28
  unless ENV['CI']
28
29
  gem 'launchy'
29
30
  end
@@ -6,7 +6,7 @@ $('#element_<%= @element.id %>').hide(200, function() {
6
6
  $('#element_trash_button .icon').addClass('full');
7
7
  Alchemy.PreviewWindow.refresh();
8
8
  <% @element.contents.essence_richtexts.each do |content| %>
9
- tinymce.get('contents_content_<%= content.id %>_body').remove();
9
+ tinymce.get('tinymce_<%= content.id %>').remove();
10
10
  <% end %>
11
11
  <%= update_essence_select_elements(@page, @element) -%>
12
12
  });
@@ -1,6 +1,6 @@
1
1
  module Alchemy
2
2
 
3
- VERSION = "2.8.1"
3
+ VERSION = "2.8.2"
4
4
 
5
5
  def self.version
6
6
  VERSION
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'element create feature', js: true do
4
+ let(:a_page) { FactoryGirl.create(:page) }
5
+
6
+ before do
7
+ authorize_as_admin
8
+ visit edit_admin_page_path(a_page)
9
+ expect(page).to have_no_selector('.alchemy-elements-window .element_editor')
10
+ end
11
+
12
+ it "adds a new element to the list" do
13
+ create_element!
14
+ expect(page).to have_no_selector(".spinner") # wait until spinner disappears
15
+ expect(page).to have_selector(".element_editor", count: 1)
16
+ end
17
+ end
18
+
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe "element trash feature", js: true do
4
+ let(:a_page) { FactoryGirl.create(:page) }
5
+
6
+ before do
7
+ authorize_as_admin
8
+ visit edit_admin_page_path(a_page)
9
+ create_element! # We want to trash an article element later because it contains a richtext essence
10
+ expect(page).to have_no_selector(".spinner") # wait until spinner disappears
11
+ end
12
+
13
+ it "removes an element from the list" do
14
+ expect(page).to have_selector(".element_editor", count: 1)
15
+ within ".alchemy-elements-window .element_editor:first" do
16
+ click_link Alchemy::I18n.t("trash element")
17
+ end
18
+ expect(page).to have_content Alchemy::I18n.t('Element trashed')
19
+ expect(page).to have_no_selector(".element_editor")
20
+ end
21
+ end
@@ -24,7 +24,7 @@ module Alchemy
24
24
  it "one should be able to switch the language tree" do
25
25
  visit('/admin/pages')
26
26
  page.select 'Klingonian', :from => 'language'
27
- page.should have_selector('#sitemap .sitemap_pagename_link', :text => 'Klingonian')
27
+ page.should have_selector('#sitemap', :text => 'Klingonian')
28
28
  end
29
29
 
30
30
  after { Capybara.default_wait_time = 2 } # Reset to default
data/spec/spec_helper.rb CHANGED
@@ -33,6 +33,11 @@ Capybara.default_selector = :css
33
33
  Capybara.register_driver(:rack_test_translated_header) do |app|
34
34
  Capybara::RackTest::Driver.new(app, :headers => { 'HTTP_ACCEPT_LANGUAGE' => 'de' })
35
35
  end
36
+ if ENV['CI']
37
+ Capybara.register_driver :poltergeist do |app|
38
+ Capybara::Poltergeist::Driver.new(app, timeout: 60)
39
+ end
40
+ end
36
41
  Capybara.javascript_driver = :poltergeist
37
42
 
38
43
  # Load support files
@@ -48,15 +53,32 @@ RSpec.configure do |config|
48
53
  config.include Devise::TestHelpers, :type => :controller
49
54
  config.include Alchemy::Specs::ControllerHelpers, :type => :controller
50
55
  config.include Alchemy::Specs::IntegrationHelpers, :type => :feature
51
- config.use_transactional_fixtures = true
52
- # Make sure the database is clean and ready for test
56
+ config.use_transactional_fixtures = false
57
+
53
58
  config.before(:suite) do
54
- truncate_all_tables
59
+ DatabaseCleaner.clean_with(:truncation)
55
60
  Alchemy::Seeder.seed!
56
61
  end
57
- # Ensuring that the locale is always resetted to :en before running any tests
62
+
63
+ # All specs are running in transactions, but feature specs not.
58
64
  config.before(:each) do
59
65
  Alchemy::Site.current = nil
60
66
  ::I18n.locale = :en
67
+ if example.metadata[:type] == :feature
68
+ DatabaseCleaner.strategy = :truncation
69
+ else
70
+ DatabaseCleaner.strategy = :transaction
71
+ end
72
+ DatabaseCleaner.start
73
+ end
74
+
75
+ # After each spec the database gets cleaned. (via rollback or truncate for feature specs)
76
+ # After every feature spec the database gets seeded so the next spec can rely on that data.
77
+ config.append_after(:each) do
78
+ DatabaseCleaner.clean
79
+ if example.metadata[:type] == :feature
80
+ Alchemy::Seeder.stub(:puts)
81
+ Alchemy::Seeder.seed!
82
+ end
61
83
  end
62
84
  end
@@ -60,6 +60,20 @@ module Alchemy
60
60
  FactoryGirl.create(:admin_user)
61
61
  end
62
62
 
63
+ # Capybara actions to create a new element.
64
+ #
65
+ # You can pass the name of the desired element, or just use the default "Article".
66
+ #
67
+ def create_element!(name = 'Article')
68
+ within '.alchemy-elements-window' do
69
+ click_link Alchemy::I18n.t('New Element')
70
+ end
71
+ within '.new_alchemy_element' do
72
+ select(name, from: 'element[name]')
73
+ click_button 'Add'
74
+ end
75
+ end
76
+
63
77
  end
64
78
 
65
79
  end
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.8.1
4
+ version: 2.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-04-23 00:00:00.000000000 Z
15
+ date: 2014-05-26 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails
@@ -918,6 +918,8 @@ files:
918
918
  - spec/dummy/public/stylesheets/.gitkeep
919
919
  - spec/dummy/script/rails
920
920
  - spec/fast_specs.rb
921
+ - spec/features/admin/element_create_feature_spec.rb
922
+ - spec/features/admin/element_trash_feature_spec.rb
921
923
  - spec/features/admin/link_overlay_spec.rb
922
924
  - spec/features/admin/modules_integration_spec.rb
923
925
  - spec/features/admin/pages_controller_spec.rb
@@ -989,7 +991,6 @@ files:
989
991
  - spec/support/alchemy/controller_hacks.rb
990
992
  - spec/support/alchemy/controller_helpers.rb
991
993
  - spec/support/alchemy/integration_helpers.rb
992
- - spec/support/alchemy/test_tweaks.rb
993
994
  - spec/support/ci/install_phantomjs
994
995
  - spec/support/factories.rb
995
996
  - spec/support/image with spaces.png
@@ -1210,6 +1211,8 @@ test_files:
1210
1211
  - spec/dummy/public/stylesheets/.gitkeep
1211
1212
  - spec/dummy/script/rails
1212
1213
  - spec/fast_specs.rb
1214
+ - spec/features/admin/element_create_feature_spec.rb
1215
+ - spec/features/admin/element_trash_feature_spec.rb
1213
1216
  - spec/features/admin/link_overlay_spec.rb
1214
1217
  - spec/features/admin/modules_integration_spec.rb
1215
1218
  - spec/features/admin/pages_controller_spec.rb
@@ -1281,7 +1284,6 @@ test_files:
1281
1284
  - spec/support/alchemy/controller_hacks.rb
1282
1285
  - spec/support/alchemy/controller_helpers.rb
1283
1286
  - spec/support/alchemy/integration_helpers.rb
1284
- - spec/support/alchemy/test_tweaks.rb
1285
1287
  - spec/support/ci/install_phantomjs
1286
1288
  - spec/support/factories.rb
1287
1289
  - spec/support/image with spaces.png
@@ -1,31 +0,0 @@
1
- # https://gist.github.com/mperham/3049152
2
- # Fixes Capybara database connection issues
3
- class ActiveRecord::Base
4
- mattr_accessor :shared_connection
5
- @@shared_connection = nil
6
-
7
- def self.connection
8
- @@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection }
9
- end
10
- end
11
- ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
12
-
13
- # fast truncation of all tables that need truncations (select is 10x faster then truncate)
14
- # http://grosser.it/2012/07/03/rubyactiverecord-fastest-way-to-truncate-test-database/
15
- def truncate_all_tables
16
- config = ActiveRecord::Base.configurations[::Rails.env]
17
- connection = ActiveRecord::Base.connection
18
- connection.disable_referential_integrity do
19
- connection.tables.each do |table_name|
20
- next if connection.select_value("SELECT count(*) FROM #{table_name}") == 0
21
- case config["adapter"]
22
- when "mysql2", "postgresql"
23
- connection.execute("TRUNCATE #{table_name}")
24
- when "sqlite3"
25
- connection.execute("DELETE FROM #{table_name}")
26
- connection.execute("DELETE FROM sqlite_sequence where name='#{table_name}'")
27
- end
28
- end
29
- connection.execute("VACUUM") if config["adapter"] == "sqlite3"
30
- end
31
- end