alchemy_cms 2.7.3 → 2.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/app/views/alchemy/admin/elements/trash.js.erb +1 -1
- data/lib/alchemy/version.rb +1 -1
- data/spec/features/admin/element_create_feature_spec.rb +18 -0
- data/spec/features/admin/element_trash_feature_spec.rb +21 -0
- data/spec/spec_helper.rb +26 -4
- data/spec/support/alchemy/integration_helpers.rb +14 -0
- metadata +6 -4
- data/spec/support/alchemy/test_tweaks.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec39e6f9f8433170bdf6cfa12566eded64cc8970
|
4
|
+
data.tar.gz: 79ae67d762d97a743c584a0bd5e1d2df47ff56a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36f7ce8de540fdb2d2830be679ac0215e6d16115342653ad83cb8ae84a0589d3b78b3e46d01ad3da7c413bb6cd4a78d6d326402a4e2001e57515510c7e6ba304
|
7
|
+
data.tar.gz: 3c1d7a9aab4b031126c5113deb889d7f7c12ac54e2d22e422bb0761bb7538f914a7b7983df534bb0ed454d4b9f460e518dfb24ca70a548e2da0639bbb721ae4d
|
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
|
-
|
9
|
+
tinymce.get('tinymce_<%= content.id %>').remove();
|
10
10
|
<% end %>
|
11
11
|
<%= update_essence_select_elements(@page, @element) -%>
|
12
12
|
});
|
data/lib/alchemy/version.rb
CHANGED
@@ -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
|
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 =
|
52
|
-
|
56
|
+
config.use_transactional_fixtures = false
|
57
|
+
|
53
58
|
config.before(:suite) do
|
54
|
-
|
59
|
+
DatabaseCleaner.clean_with(:truncation)
|
55
60
|
Alchemy::Seeder.seed!
|
56
61
|
end
|
57
|
-
|
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.7.
|
4
|
+
version: 2.7.4
|
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-
|
15
|
+
date: 2014-05-27 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
@@ -917,6 +917,8 @@ files:
|
|
917
917
|
- spec/dummy/public/stylesheets/.gitkeep
|
918
918
|
- spec/dummy/script/rails
|
919
919
|
- spec/fast_specs.rb
|
920
|
+
- spec/features/admin/element_create_feature_spec.rb
|
921
|
+
- spec/features/admin/element_trash_feature_spec.rb
|
920
922
|
- spec/features/admin/link_overlay_spec.rb
|
921
923
|
- spec/features/admin/modules_integration_spec.rb
|
922
924
|
- spec/features/admin/pages_controller_spec.rb
|
@@ -988,7 +990,6 @@ files:
|
|
988
990
|
- spec/support/alchemy/controller_hacks.rb
|
989
991
|
- spec/support/alchemy/controller_helpers.rb
|
990
992
|
- spec/support/alchemy/integration_helpers.rb
|
991
|
-
- spec/support/alchemy/test_tweaks.rb
|
992
993
|
- spec/support/ci/install_phantomjs
|
993
994
|
- spec/support/factories.rb
|
994
995
|
- spec/support/image with spaces.png
|
@@ -1209,6 +1210,8 @@ test_files:
|
|
1209
1210
|
- spec/dummy/public/stylesheets/.gitkeep
|
1210
1211
|
- spec/dummy/script/rails
|
1211
1212
|
- spec/fast_specs.rb
|
1213
|
+
- spec/features/admin/element_create_feature_spec.rb
|
1214
|
+
- spec/features/admin/element_trash_feature_spec.rb
|
1212
1215
|
- spec/features/admin/link_overlay_spec.rb
|
1213
1216
|
- spec/features/admin/modules_integration_spec.rb
|
1214
1217
|
- spec/features/admin/pages_controller_spec.rb
|
@@ -1280,7 +1283,6 @@ test_files:
|
|
1280
1283
|
- spec/support/alchemy/controller_hacks.rb
|
1281
1284
|
- spec/support/alchemy/controller_helpers.rb
|
1282
1285
|
- spec/support/alchemy/integration_helpers.rb
|
1283
|
-
- spec/support/alchemy/test_tweaks.rb
|
1284
1286
|
- spec/support/ci/install_phantomjs
|
1285
1287
|
- spec/support/factories.rb
|
1286
1288
|
- 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
|