alchemy_cms 3.3.0.rc1 → 3.3.0.rc2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -2
- data/Gemfile +1 -0
- data/alchemy_cms.gemspec +6 -6
- data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +0 -7
- data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +4 -4
- data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +51 -5
- data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +0 -2
- data/app/assets/stylesheets/alchemy/elements.scss +2 -2
- data/app/controllers/alchemy/admin/elements_controller.rb +2 -0
- data/app/controllers/alchemy/admin/pages_controller.rb +11 -3
- data/app/controllers/alchemy/admin/pictures_controller.rb +1 -0
- data/app/models/alchemy/element.rb +3 -1
- data/app/models/alchemy/element/element_contents.rb +2 -7
- data/app/models/alchemy/element/presenters.rb +11 -4
- data/app/models/alchemy/page.rb +3 -1
- data/app/views/alchemy/admin/attachments/archive_overlay.js.erb +0 -1
- data/app/views/alchemy/admin/contents/create.js.erb +0 -1
- data/app/views/alchemy/admin/elements/_element_header.html.erb +3 -1
- data/app/views/alchemy/admin/elements/order.js.erb +25 -10
- data/app/views/alchemy/admin/elements/update.js.erb +1 -2
- data/app/views/alchemy/admin/essence_files/assign.js.erb +0 -1
- data/app/views/alchemy/admin/essence_pictures/assign.js.erb +0 -1
- data/app/views/alchemy/admin/legacy_page_urls/create.js.erb +0 -1
- data/app/views/alchemy/admin/pages/destroy.js.erb +0 -1
- data/app/views/alchemy/admin/pages/update.js.erb +6 -4
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +2 -1
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -7
- data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +0 -1
- data/bin/alchemy +1 -1
- data/bin/rspec +3 -2
- data/bin/spring +6 -6
- data/config/alchemy/config.yml +6 -1
- data/lib/alchemy/seeder.rb +9 -3
- data/lib/alchemy/version.rb +1 -1
- metadata +6 -471
- data/spec/controllers/alchemy/admin/attachments_controller_spec.rb +0 -193
- data/spec/controllers/alchemy/admin/base_controller_spec.rb +0 -87
- data/spec/controllers/alchemy/admin/clipboard_controller_spec.rb +0 -60
- data/spec/controllers/alchemy/admin/contents_controller_spec.rb +0 -78
- data/spec/controllers/alchemy/admin/dashboard_controller_spec.rb +0 -144
- data/spec/controllers/alchemy/admin/elements_controller_spec.rb +0 -496
- data/spec/controllers/alchemy/admin/essence_files_controller_spec.rb +0 -76
- data/spec/controllers/alchemy/admin/essence_pictures_controller_spec.rb +0 -202
- data/spec/controllers/alchemy/admin/languages_controller_spec.rb +0 -73
- data/spec/controllers/alchemy/admin/layoutpages_controller_spec.rb +0 -21
- data/spec/controllers/alchemy/admin/pages_controller_spec.rb +0 -639
- data/spec/controllers/alchemy/admin/pictures_controller_spec.rb +0 -383
- data/spec/controllers/alchemy/admin/resources_controller_spec.rb +0 -81
- data/spec/controllers/alchemy/admin/tags_controller_spec.rb +0 -63
- data/spec/controllers/alchemy/admin/trash_controller_spec.rb +0 -67
- data/spec/controllers/alchemy/api/contents_controller_spec.rb +0 -125
- data/spec/controllers/alchemy/api/elements_controller_spec.rb +0 -124
- data/spec/controllers/alchemy/api/pages_controller_spec.rb +0 -167
- data/spec/controllers/alchemy/attachments_controller_spec.rb +0 -64
- data/spec/controllers/alchemy/base_controller_spec.rb +0 -106
- data/spec/controllers/alchemy/elements_controller_spec.rb +0 -48
- data/spec/controllers/alchemy/messages_controller_spec.rb +0 -204
- data/spec/controllers/alchemy/on_page_layout_mixin_spec.rb +0 -330
- data/spec/controllers/alchemy/pages_controller_spec.rb +0 -343
- data/spec/controllers/alchemy/pictures_controller_spec.rb +0 -415
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/controllers/admin/events_controller.rb +0 -3
- data/spec/dummy/app/controllers/application_controller.rb +0 -15
- data/spec/dummy/app/controllers/login_controller.rb +0 -5
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/ability.rb +0 -9
- data/spec/dummy/app/models/dummy_model.rb +0 -3
- data/spec/dummy/app/models/dummy_user.rb +0 -15
- data/spec/dummy/app/models/event.rb +0 -10
- data/spec/dummy/app/models/location.rb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_all_you_can_eat_editor.html.erb +0 -11
- data/spec/dummy/app/views/alchemy/elements/_all_you_can_eat_view.html.erb +0 -31
- data/spec/dummy/app/views/alchemy/elements/_article_editor.html.erb +0 -6
- data/spec/dummy/app/views/alchemy/elements/_article_view.html.erb +0 -10
- data/spec/dummy/app/views/alchemy/elements/_bild_editor.html.erb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_bild_view.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/elements/_contactform_editor.html.erb +0 -6
- data/spec/dummy/app/views/alchemy/elements/_contactform_view.html.erb +0 -16
- data/spec/dummy/app/views/alchemy/elements/_download_editor.html.erb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_download_view.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/elements/_erb_element_editor.html.erb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_erb_element_view.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/elements/_header_editor.html.erb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_header_view.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/elements/_headline_editor.html.erb +0 -1
- data/spec/dummy/app/views/alchemy/elements/_headline_view.html.erb +0 -1
- data/spec/dummy/app/views/alchemy/elements/_news_editor.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/elements/_news_view.html.erb +0 -11
- data/spec/dummy/app/views/alchemy/elements/_search_editor.html.erb +0 -1
- data/spec/dummy/app/views/alchemy/elements/_search_view.html.erb +0 -4
- data/spec/dummy/app/views/alchemy/elements/_slide_editor.html.erb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_slide_view.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/elements/_slider_editor.html.erb +0 -2
- data/spec/dummy/app/views/alchemy/elements/_slider_view.html.erb +0 -4
- data/spec/dummy/app/views/alchemy/elements/_text_editor.html.erb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_text_view.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/page_layouts/_standard.html.erb +0 -15
- data/spec/dummy/app/views/layouts/application.html.erb +0 -17
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/alchemy/cells.yml +0 -5
- data/spec/dummy/config/alchemy/elements.yml +0 -109
- data/spec/dummy/config/alchemy/page_layouts.yml +0 -32
- data/spec/dummy/config/application.rb +0 -32
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -32
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -41
- data/spec/dummy/config/environments/production.rb +0 -77
- data/spec/dummy/config/environments/test.rb +0 -43
- data/spec/dummy/config/initializers/alchemy.rb +0 -3
- data/spec/dummy/config/initializers/assets.rb +0 -11
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/secret_token.rb +0 -12
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/kl.yml +0 -2
- data/spec/dummy/config/routes.rb +0 -12
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/db/migrate/20121026104128_create_events.rb +0 -20
- data/spec/dummy/db/migrate/20130328101418_create_locations.rb +0 -9
- data/spec/dummy/db/migrate/20130827094554_alchemy_two_point_six.rb +0 -1
- data/spec/dummy/db/migrate/20130828121054_remove_do_not_index_from_alchemy_essence_texts.rb +0 -1
- data/spec/dummy/db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb +0 -1
- data/spec/dummy/db/migrate/20130918201742_add_published_at_to_alchemy_pages.rb +0 -1
- data/spec/dummy/db/migrate/20131209225243_create_dummy_users.rb +0 -9
- data/spec/dummy/db/migrate/20150122213511_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +0 -31
- data/spec/dummy/db/migrate/20150122213512_add_missing_unique_indices.acts_as_taggable_on_engine.rb +0 -20
- data/spec/dummy/db/migrate/20150122213513_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +0 -15
- data/spec/dummy/db/migrate/20150122213514_add_missing_taggable_index.acts_as_taggable_on_engine.rb +0 -10
- data/spec/dummy/db/migrate/20150412103152_create_dummy_model.rb +0 -7
- data/spec/dummy/db/migrate/20150608204610_add_parent_element_id_to_alchemy_elements.rb +0 -1
- data/spec/dummy/db/migrate/20150729151825_add_link_text_to_alchemy_essence_files.rb +0 -1
- data/spec/dummy/db/migrate/20150906195818_add_locale_to_alchemy_languages.rb +0 -1
- data/spec/dummy/db/schema.rb +0 -326
- data/spec/dummy/db/seeds.rb +0 -1
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/spec/javascripts +0 -1
- data/spec/factories.rb +0 -13
- data/spec/features/admin/admin_layout_spec.rb +0 -14
- data/spec/features/admin/dashboard_spec.rb +0 -81
- data/spec/features/admin/edit_elements_feature_spec.rb +0 -36
- data/spec/features/admin/language_tree_feature_spec.rb +0 -32
- data/spec/features/admin/languages_features_spec.rb +0 -65
- data/spec/features/admin/legacy_page_url_management_spec.rb +0 -62
- data/spec/features/admin/link_overlay_spec.rb +0 -53
- data/spec/features/admin/locale_select_feature_spec.rb +0 -25
- data/spec/features/admin/modules_integration_spec.rb +0 -23
- data/spec/features/admin/navigation_feature_spec.rb +0 -22
- data/spec/features/admin/page_creation_feature_spec.rb +0 -51
- data/spec/features/admin/page_editing_feature_spec.rb +0 -135
- data/spec/features/admin/picture_library_integration_spec.rb +0 -62
- data/spec/features/admin/resources_integration_spec.rb +0 -128
- data/spec/features/admin/site_select_feature_spec.rb +0 -31
- data/spec/features/admin/tinymce_feature_spec.rb +0 -33
- data/spec/features/navigation_spec.rb +0 -9
- data/spec/features/page_feature_spec.rb +0 -186
- data/spec/features/page_redirects_spec.rb +0 -358
- data/spec/features/picture_security_spec.rb +0 -29
- data/spec/features/security_spec.rb +0 -24
- data/spec/features/translation_integration_spec.rb +0 -51
- data/spec/fixtures/500x500.png +0 -0
- data/spec/fixtures/80x60.png +0 -0
- data/spec/fixtures/animated.gif +0 -0
- data/spec/fixtures/image with spaces.png +0 -0
- data/spec/fixtures/image.png +0 -0
- data/spec/fixtures/image2.PNG +0 -0
- data/spec/fixtures/image3.jpeg +0 -0
- data/spec/helpers/alchemy/admin/attachments_helper_spec.rb +0 -15
- data/spec/helpers/alchemy/admin/base_helper_spec.rb +0 -280
- data/spec/helpers/alchemy/admin/contents_helper_spec.rb +0 -46
- data/spec/helpers/alchemy/admin/elements_helper_spec.rb +0 -314
- data/spec/helpers/alchemy/admin/essences_helper_spec.rb +0 -201
- data/spec/helpers/alchemy/admin/navigation_helper_spec.rb +0 -294
- data/spec/helpers/alchemy/admin/pages_helper_spec.rb +0 -63
- data/spec/helpers/alchemy/admin/pictures_helper_spec.rb +0 -28
- data/spec/helpers/alchemy/admin/tags_helper_spec.rb +0 -111
- data/spec/helpers/alchemy/base_helper_spec.rb +0 -44
- data/spec/helpers/alchemy/elements_block_helper_spec.rb +0 -135
- data/spec/helpers/alchemy/elements_helper_spec.rb +0 -326
- data/spec/helpers/alchemy/essences_helper_spec.rb +0 -85
- data/spec/helpers/alchemy/pages_helper_spec.rb +0 -499
- data/spec/helpers/alchemy/picture_url_helpers_spec.rb +0 -78
- data/spec/helpers/alchemy/url_helper_spec.rb +0 -200
- data/spec/javascripts/alchemy/dialog_spec.coffee +0 -82
- data/spec/javascripts/alchemy/link_overlay_spec.coffee +0 -25
- data/spec/javascripts/alchemy_integration_spec.coffee +0 -3
- data/spec/javascripts/fixtures/select.html +0 -3
- data/spec/javascripts/helpers/mock-ajax.js +0 -199
- data/spec/javascripts/helpers/test_responses/test_responses.js +0 -1
- data/spec/javascripts/support/jasmine.yml +0 -29
- data/spec/libraries/auth_accessors_spec.rb +0 -40
- data/spec/libraries/config_spec.rb +0 -111
- data/spec/libraries/controller_actions_spec.rb +0 -133
- data/spec/libraries/i18n_spec.rb +0 -37
- data/spec/libraries/kaminari/scoped_pagination_url_helper_spec.rb +0 -30
- data/spec/libraries/modules_spec.rb +0 -67
- data/spec/libraries/mount_point_spec.rb +0 -77
- data/spec/libraries/page_layout_spec.rb +0 -150
- data/spec/libraries/paths_spec.rb +0 -15
- data/spec/libraries/permissions_spec.rb +0 -260
- data/spec/libraries/resource_spec.rb +0 -344
- data/spec/libraries/resources_helper_spec.rb +0 -193
- data/spec/libraries/shell_spec.rb +0 -121
- data/spec/libraries/template_tracker_spec.rb +0 -85
- data/spec/libraries/tinymce_spec.rb +0 -111
- data/spec/libraries/userstamp_spec.rb +0 -10
- data/spec/mailers/alchemy/messages_spec.rb +0 -21
- data/spec/models/alchemy/attachment_spec.rb +0 -250
- data/spec/models/alchemy/cell_spec.rb +0 -101
- data/spec/models/alchemy/content_spec.rb +0 -513
- data/spec/models/alchemy/element_spec.rb +0 -862
- data/spec/models/alchemy/element_to_page_spec.rb +0 -13
- data/spec/models/alchemy/essence_boolean_spec.rb +0 -10
- data/spec/models/alchemy/essence_date_spec.rb +0 -28
- data/spec/models/alchemy/essence_file_spec.rb +0 -40
- data/spec/models/alchemy/essence_html_spec.rb +0 -18
- data/spec/models/alchemy/essence_link_spec.rb +0 -10
- data/spec/models/alchemy/essence_picture_spec.rb +0 -255
- data/spec/models/alchemy/essence_richtext_spec.rb +0 -23
- data/spec/models/alchemy/essence_select_spec.rb +0 -10
- data/spec/models/alchemy/essence_text_spec.rb +0 -110
- data/spec/models/alchemy/language_spec.rb +0 -243
- data/spec/models/alchemy/legacy_page_url_spec.rb +0 -21
- data/spec/models/alchemy/message_spec.rb +0 -55
- data/spec/models/alchemy/page_spec.rb +0 -2108
- data/spec/models/alchemy/picture_spec.rb +0 -418
- data/spec/models/alchemy/site_spec.rb +0 -168
- data/spec/models/alchemy/tag_spec.rb +0 -29
- data/spec/models/dummy_model_spec.rb +0 -10
- data/spec/requests/alchemy/admin/resources_requests_spec.rb +0 -26
- data/spec/requests/alchemy/admin/site_requests_spec.rb +0 -19
- data/spec/requests/alchemy/site_requests_spec.rb +0 -18
- data/spec/requests/alchemy/sitemap_spec.rb +0 -56
- data/spec/routing/api_routing_spec.rb +0 -150
- data/spec/routing/routing_spec.rb +0 -340
- data/spec/spec_helper.rb +0 -90
- data/spec/support/ci/install_phantomjs +0 -7
- data/spec/support/hint_examples.rb +0 -28
- data/spec/support/test_tweaks.rb +0 -31
- data/spec/support/transformation_examples.rb +0 -179
- data/spec/tasks/helpers_spec.rb +0 -217
- data/spec/views/admin/pictures/show_spec.rb +0 -43
- data/spec/views/essences/essence_boolean_editor_spec.rb +0 -32
- data/spec/views/essences/essence_boolean_view_spec.rb +0 -23
- data/spec/views/essences/essence_date_view_spec.rb +0 -38
- data/spec/views/essences/essence_file_editor_spec.rb +0 -59
- data/spec/views/essences/essence_file_view_spec.rb +0 -77
- data/spec/views/essences/essence_html_view_spec.rb +0 -22
- data/spec/views/essences/essence_link_view_spec.rb +0 -41
- data/spec/views/essences/essence_picture_editor_spec.rb +0 -80
- data/spec/views/essences/essence_picture_view_spec.rb +0 -128
- data/spec/views/essences/essence_richtext_view_spec.rb +0 -32
- data/spec/views/essences/essence_select_view_spec.rb +0 -11
- data/spec/views/essences/essence_text_view_spec.rb +0 -51
data/spec/spec_helper.rb
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
if ENV['TRAVIS']
|
|
2
|
-
require "codeclimate-test-reporter"
|
|
3
|
-
CodeClimate::TestReporter.start
|
|
4
|
-
else
|
|
5
|
-
require 'simplecov'
|
|
6
|
-
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
|
|
7
|
-
SimpleCov.start 'rails'
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
# Configure Rails Environment
|
|
11
|
-
ENV["RAILS_ENV"] = "test"
|
|
12
|
-
|
|
13
|
-
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
14
|
-
require 'rspec/rails'
|
|
15
|
-
require 'rails/test_help'
|
|
16
|
-
require 'capybara/poltergeist'
|
|
17
|
-
require 'capybara/rails'
|
|
18
|
-
require 'database_cleaner'
|
|
19
|
-
require 'rspec-activemodel-mocks'
|
|
20
|
-
|
|
21
|
-
require 'alchemy/seeder'
|
|
22
|
-
require 'alchemy/test_support/controller_requests'
|
|
23
|
-
require 'alchemy/test_support/essence_shared_examples'
|
|
24
|
-
require 'alchemy/test_support/integration_helpers'
|
|
25
|
-
require 'alchemy/test_support/factories'
|
|
26
|
-
|
|
27
|
-
require_relative 'factories'
|
|
28
|
-
require_relative "support/hint_examples.rb"
|
|
29
|
-
require_relative "support/transformation_examples.rb"
|
|
30
|
-
|
|
31
|
-
ActionMailer::Base.delivery_method = :test
|
|
32
|
-
ActionMailer::Base.perform_deliveries = true
|
|
33
|
-
ActionMailer::Base.default_url_options[:host] = "test.com"
|
|
34
|
-
|
|
35
|
-
Rails.backtrace_cleaner.remove_silencers!
|
|
36
|
-
# Disable rails loggin for faster IO. Remove this if you want to have a test.log
|
|
37
|
-
Rails.logger.level = 4
|
|
38
|
-
|
|
39
|
-
# Configure capybara for integration testing
|
|
40
|
-
Capybara.default_driver = :rack_test
|
|
41
|
-
Capybara.default_selector = :css
|
|
42
|
-
Capybara.register_driver :poltergeist do |app|
|
|
43
|
-
Capybara::Poltergeist::Driver.new(app)
|
|
44
|
-
end
|
|
45
|
-
Capybara.javascript_driver = :poltergeist
|
|
46
|
-
Capybara.ignore_hidden_elements = false
|
|
47
|
-
|
|
48
|
-
RSpec.configure do |config|
|
|
49
|
-
config.infer_spec_type_from_file_location!
|
|
50
|
-
config.raise_errors_for_deprecations!
|
|
51
|
-
config.run_all_when_everything_filtered = true
|
|
52
|
-
config.filter_run :focus
|
|
53
|
-
config.include ActiveSupport::Testing::TimeHelpers
|
|
54
|
-
config.include Alchemy::Engine.routes.url_helpers
|
|
55
|
-
config.include Alchemy::TestSupport::ControllerRequests, type: :controller
|
|
56
|
-
[:controller, :feature, :request].each do |type|
|
|
57
|
-
config.include Alchemy::TestSupport::IntegrationHelpers, type: type
|
|
58
|
-
end
|
|
59
|
-
config.include FactoryGirl::Syntax::Methods
|
|
60
|
-
|
|
61
|
-
config.use_transactional_fixtures = false
|
|
62
|
-
# Make sure the database is clean and ready for test
|
|
63
|
-
config.before(:suite) do
|
|
64
|
-
DatabaseCleaner.clean_with(:truncation)
|
|
65
|
-
Alchemy::Shell.silence!
|
|
66
|
-
Alchemy::Seeder.seed!
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
# All specs are running in transactions, but feature specs not.
|
|
70
|
-
config.before(:each) do |example|
|
|
71
|
-
Alchemy::Site.current = nil
|
|
72
|
-
::I18n.locale = :en
|
|
73
|
-
if example.metadata[:type] == :feature
|
|
74
|
-
DatabaseCleaner.strategy = :truncation
|
|
75
|
-
else
|
|
76
|
-
DatabaseCleaner.strategy = :transaction
|
|
77
|
-
end
|
|
78
|
-
DatabaseCleaner.start
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
# After each spec the database gets cleaned. (via rollback or truncate for feature specs)
|
|
82
|
-
# After every feature spec the database gets seeded so the next spec can rely on that data.
|
|
83
|
-
config.append_after(:each) do
|
|
84
|
-
DatabaseCleaner.clean
|
|
85
|
-
if RSpec.current_example.metadata[:type] == :feature
|
|
86
|
-
allow(Alchemy::Seeder).to receive(:puts)
|
|
87
|
-
Alchemy::Seeder.seed!
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module Alchemy
|
|
4
|
-
shared_examples_for "having a hint" do
|
|
5
|
-
describe '#hint' do
|
|
6
|
-
context 'with hint as text' do
|
|
7
|
-
before do
|
|
8
|
-
expect(subject).to receive(:definition).and_return({'hint' => 'The hint'})
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "returns the hint" do
|
|
12
|
-
expect(subject.hint).to eq('The hint')
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context 'with hint set to true' do
|
|
17
|
-
before do
|
|
18
|
-
expect(subject).to receive(:definition).and_return({'hint' => true})
|
|
19
|
-
expect(Alchemy).to receive(:t).and_return('The hint')
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "returns the hint from translation" do
|
|
23
|
-
expect(subject.hint).to eq('The hint')
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
data/spec/support/test_tweaks.rb
DELETED
|
@@ -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
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module Alchemy
|
|
4
|
-
shared_examples_for "has image transformations" do
|
|
5
|
-
describe "#thumbnail_size" do
|
|
6
|
-
context "picture is 300x400 and has no crop size" do
|
|
7
|
-
it "should return the correct recalculated size value" do
|
|
8
|
-
allow(picture).to receive(:image_file_width) { 400 }
|
|
9
|
-
allow(picture).to receive(:image_file_height) { 300 }
|
|
10
|
-
|
|
11
|
-
expect(picture.thumbnail_size).to eq('111x83')
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
context "picture is 300x400 and has no crop size" do
|
|
16
|
-
it "should return the correct recalculated size value" do
|
|
17
|
-
allow(picture).to receive(:image_file_width) { 300 }
|
|
18
|
-
allow(picture).to receive(:image_file_height) { 400 }
|
|
19
|
-
|
|
20
|
-
expect(picture.thumbnail_size).to eq('70x93')
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
context "picture has crop_size of 400x300" do
|
|
25
|
-
it "scales to 400x300 if that is the size of the cropped image" do
|
|
26
|
-
allow(picture).to receive(:crop_size) { "400x300" }
|
|
27
|
-
expect(picture.thumbnail_size).to eq('111x83')
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
context "picture has crop_size of 0x0" do
|
|
32
|
-
it "returns default thumbnail size" do
|
|
33
|
-
allow(picture).to receive(:crop_size) { "0x0" }
|
|
34
|
-
expect(picture.thumbnail_size).to eq('111x93')
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
describe '#landscape_format?' do
|
|
40
|
-
subject { picture.landscape_format? }
|
|
41
|
-
|
|
42
|
-
context 'image has landscape format' do
|
|
43
|
-
before { allow(picture).to receive(:image_file).and_return double(landscape?: true) }
|
|
44
|
-
|
|
45
|
-
it { is_expected.to be_truthy }
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
context 'image has portrait format' do
|
|
49
|
-
before { allow(picture).to receive(:image_file).and_return double(landscape?: false) }
|
|
50
|
-
|
|
51
|
-
it { is_expected.to be_falsey }
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
it "is aliased as landscape?" do
|
|
55
|
-
expect(picture.respond_to?(:landscape?)).to be_truthy
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
describe '#portrait_format?' do
|
|
60
|
-
subject { picture.portrait_format? }
|
|
61
|
-
|
|
62
|
-
context 'image has portrait format' do
|
|
63
|
-
before { allow(picture).to receive(:image_file).and_return double(portrait?: true) }
|
|
64
|
-
|
|
65
|
-
it { is_expected.to be_truthy }
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
context 'image has landscape format' do
|
|
69
|
-
before { allow(picture).to receive(:image_file).and_return double(portrait?: false) }
|
|
70
|
-
|
|
71
|
-
it { is_expected.to be_falsey }
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it "is aliased as portrait?" do
|
|
75
|
-
expect(picture.respond_to?(:portrait?)).to be_truthy
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
describe '#square_format?' do
|
|
80
|
-
subject { picture.square_format? }
|
|
81
|
-
|
|
82
|
-
context 'image has square format' do
|
|
83
|
-
before { expect(picture).to receive(:image_file).and_return double(aspect_ratio: 1.0) }
|
|
84
|
-
|
|
85
|
-
it { is_expected.to be_truthy }
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
context 'image has rectangle format' do
|
|
89
|
-
before { expect(picture).to receive(:image_file).and_return double(aspect_ratio: 8.0) }
|
|
90
|
-
|
|
91
|
-
it { is_expected.to be_falsey }
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
it "is aliased as square?" do
|
|
95
|
-
expect(picture.respond_to?(:square?)).to be_truthy
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
describe '#default_mask' do
|
|
100
|
-
before do
|
|
101
|
-
allow(picture).to receive(:image_file_width) { 200 }
|
|
102
|
-
allow(picture).to receive(:image_file_height) { 100 }
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
it "should return a Hash" do
|
|
106
|
-
expect(picture.default_mask({ width: 10, height: 10 })).to be_a(Hash)
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
it "should return a Hash with four keys x1, x2, y1, y2" do
|
|
110
|
-
expect(picture.default_mask({ width: 10, height: 10 }).keys.sort).to eq([:x1, :x2, :y1, :y2])
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
it "should return a Hash where all values are Integer" do
|
|
114
|
-
expect(picture.default_mask({ width: 13, height: 13 }).all? do |_k, v|
|
|
115
|
-
v.is_a? Integer
|
|
116
|
-
end).to be_truthy
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
context "making a default cropping mask" do
|
|
120
|
-
it "to 200x50 pixel, the hash should be {x1: 0, y1: 25, x2: 200, y2: 75}" do
|
|
121
|
-
expect(picture.default_mask({ width: 200, height: 50 })).to eq({x1: 0, y1: 25, x2: 200, y2: 75})
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
it "to 0x0 pixel, it should not crop the picture" do
|
|
125
|
-
expect(picture.default_mask({ width: 0, height: 0 })).to eq({x1: 0, y1: 0, x2: 200, y2: 100})
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
it "to 50x100 pixel, the hash should be {x1: 75, y1: 0, x2: 125, y2: 100}" do
|
|
129
|
-
expect(picture.default_mask({ width: 50, height: 100 })).to eq({x1: 75, y1: 0, x2: 125, y2: 100})
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
it "to 50x50 pixel, the hash should be {x1: 50, y1: 0, x2: 150, y2: 100}" do
|
|
133
|
-
expect(picture.default_mask({ width: 50, height: 50 })).to eq({x1: 50, y1: 0, x2: 150, y2: 100})
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
it "to 400x200 pixel, the hash should be {x1: 0, y1: 0, x2: 200, y2: 100}" do
|
|
137
|
-
expect(picture.default_mask({ width: 400, height: 200 })).to eq({x1: 0, y1: 0, x2: 200, y2: 100})
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
it "to 400x100 pixel, the hash should be {x1: 0, y1: 25, x2: 200, y2: 75}" do
|
|
141
|
-
expect(picture.default_mask({ width: 400, height: 100 })).to eq({x1: 0, y1: 25, x2: 200, y2: 75})
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
it "to 200x200 pixel, the hash should be {x1: 50, y1: 0, x2: 150, y2: 100}" do
|
|
145
|
-
expect(picture.default_mask({ width: 200, height: 200 })).to eq({x1: 50, y1: 0, x2: 150, y2: 100})
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
describe "#can_be_cropped_to" do
|
|
151
|
-
context "picture is 300x400 and shall be cropped to 200x100" do
|
|
152
|
-
it "should return true" do
|
|
153
|
-
allow(picture).to receive(:image_file_width) { 400 }
|
|
154
|
-
allow(picture).to receive(:image_file_height) { 300 }
|
|
155
|
-
|
|
156
|
-
expect(picture.can_be_cropped_to("200x100")).to be_truthy
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
context "picture is 300x400 and shall be cropped to 600x500" do
|
|
161
|
-
it "should return false" do
|
|
162
|
-
allow(picture).to receive(:image_file_width) { 400 }
|
|
163
|
-
allow(picture).to receive(:image_file_height) { 300 }
|
|
164
|
-
|
|
165
|
-
expect(picture.can_be_cropped_to("600x500")).to be_falsey
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
context "picture is 300x400 and shall be cropped to 600x500 with upsample set to true" do
|
|
170
|
-
it "should return true" do
|
|
171
|
-
allow(picture).to receive(:image_file_width) { 400 }
|
|
172
|
-
allow(picture).to receive(:image_file_height) { 300 }
|
|
173
|
-
|
|
174
|
-
expect(picture.can_be_cropped_to("600x500", true)).to be_truthy
|
|
175
|
-
end
|
|
176
|
-
end
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
end
|
data/spec/tasks/helpers_spec.rb
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require 'alchemy/tasks/helpers'
|
|
3
|
-
|
|
4
|
-
module Alchemy
|
|
5
|
-
class Foo
|
|
6
|
-
extend Tasks::Helpers
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
describe "Tasks:Helpers" do
|
|
10
|
-
let(:config) do
|
|
11
|
-
{ 'test' => {
|
|
12
|
-
'adapter' => 'mysql2',
|
|
13
|
-
'username' => 'testuser',
|
|
14
|
-
'password' => '123456',
|
|
15
|
-
'host' => 'localhost'
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
before do
|
|
21
|
-
allow(File).to receive(:exist?) { true }
|
|
22
|
-
allow(File).to receive(:read) do
|
|
23
|
-
<<-END
|
|
24
|
-
test:
|
|
25
|
-
adapter: mysql2
|
|
26
|
-
username: testuser
|
|
27
|
-
password: "123456"
|
|
28
|
-
host: localhost
|
|
29
|
-
END
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
describe "#database_dump_command" do
|
|
34
|
-
subject { Foo.database_dump_command(adapter) }
|
|
35
|
-
|
|
36
|
-
context "when config for RAILS_ENV not found" do
|
|
37
|
-
let(:adapter) { 'mysql2' }
|
|
38
|
-
|
|
39
|
-
before { allow(Foo).to receive(:environment).and_return('huh?') }
|
|
40
|
-
|
|
41
|
-
it "should raise an error" do
|
|
42
|
-
expect { subject }.to raise_error(RuntimeError)
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
context "when given a not supported database adapter" do
|
|
47
|
-
let(:adapter) { 'oracle' }
|
|
48
|
-
|
|
49
|
-
it "should raise an error" do
|
|
50
|
-
expect { subject }.to raise_error(ArgumentError)
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
context "for mysql adapter" do
|
|
55
|
-
let(:adapter) { 'mysql2' }
|
|
56
|
-
|
|
57
|
-
it "uses the mysqldump command" do
|
|
58
|
-
is_expected.to include('mysqldump ')
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
context "when a username is set in the config file" do
|
|
62
|
-
it { is_expected.to include("--user='testuser'") }
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
context "when a password is set in the config file" do
|
|
66
|
-
it { is_expected.to include("--password='123456'") }
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
context "when a host is set in the config file" do
|
|
70
|
-
context "and the host is localhost" do
|
|
71
|
-
it { is_expected.not_to include("--host=") }
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
context "and the host is anything but not localhost" do
|
|
75
|
-
before do
|
|
76
|
-
allow(File).to receive(:read).and_return("test:\n host: mydomain.com")
|
|
77
|
-
end
|
|
78
|
-
it { is_expected.to include("--host='mydomain.com'") }
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
context "for postgresql adapter" do
|
|
84
|
-
let(:adapter) { 'postgresql' }
|
|
85
|
-
|
|
86
|
-
it "uses the pg_dump command with clean option" do
|
|
87
|
-
is_expected.to include('pg_dump --clean')
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
context "when a username is set in the config file" do
|
|
91
|
-
it { is_expected.to include("--username='testuser'") }
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
context "when a password is set in the config file" do
|
|
95
|
-
it { is_expected.to include("PGPASSWORD='123456'") }
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
context "when a host is set in the config file" do
|
|
99
|
-
context "and the host is localhost" do
|
|
100
|
-
it { is_expected.not_to include("--host=") }
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
context "and the host is anything but not localhost" do
|
|
104
|
-
before do
|
|
105
|
-
allow(File).to receive(:read).and_return("test:\n host: mydomain.com")
|
|
106
|
-
end
|
|
107
|
-
it { is_expected.to include("--host='mydomain.com'") }
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
after do
|
|
113
|
-
Foo.instance_variable_set("@database_config", nil) # resets the memoization
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
describe "#database_import_command" do
|
|
118
|
-
subject { Foo.database_import_command(adapter) }
|
|
119
|
-
|
|
120
|
-
context "when config for RAILS_ENV not found" do
|
|
121
|
-
let(:adapter) { 'mysql' }
|
|
122
|
-
|
|
123
|
-
before { allow(Foo).to receive(:environment).and_return('huh?') }
|
|
124
|
-
|
|
125
|
-
it "should raise an error" do
|
|
126
|
-
expect { subject }.to raise_error(RuntimeError)
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
context "when given a not supported database adapter" do
|
|
131
|
-
let(:adapter) { 'oracle' }
|
|
132
|
-
|
|
133
|
-
it "should raise an error" do
|
|
134
|
-
expect { subject }.to raise_error(ArgumentError)
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
context "for mysql adapter" do
|
|
139
|
-
let(:adapter) { 'mysql' }
|
|
140
|
-
|
|
141
|
-
it "uses the mysql command" do
|
|
142
|
-
is_expected.to include('mysql ')
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
context "when a username is set in the config file" do
|
|
146
|
-
it { is_expected.to include("--user='testuser'") }
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
context "when a password is set in the config file" do
|
|
150
|
-
it { is_expected.to include("--password='123456'") }
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
context "when a host is set in the config file" do
|
|
154
|
-
context "and the host is localhost" do
|
|
155
|
-
it { is_expected.not_to include("--host=") }
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
context "and the host is anything but not localhost" do
|
|
159
|
-
before do
|
|
160
|
-
allow(File).to receive(:read).and_return("test:\n host: mydomain.com")
|
|
161
|
-
end
|
|
162
|
-
it { is_expected.to include("--host='mydomain.com'") }
|
|
163
|
-
end
|
|
164
|
-
end
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
context "for postgresql adapter" do
|
|
168
|
-
let(:adapter) { 'postgresql' }
|
|
169
|
-
|
|
170
|
-
it "uses the psql command" do
|
|
171
|
-
is_expected.to include('psql ')
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
context "when a username is set in the config file" do
|
|
175
|
-
it { is_expected.to include("--username='testuser'") }
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
context "when a password is set in the config file" do
|
|
179
|
-
it { is_expected.to include("PGPASSWORD='123456'") }
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
context "when a host is set in the config file" do
|
|
183
|
-
context "and the host is localhost" do
|
|
184
|
-
it { is_expected.not_to include("--host=") }
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
context "and the host is anything but not localhost" do
|
|
188
|
-
before do
|
|
189
|
-
allow(File).to receive(:read).and_return("test:\n host: mydomain.com")
|
|
190
|
-
end
|
|
191
|
-
it { is_expected.to include("--host='mydomain.com'") }
|
|
192
|
-
end
|
|
193
|
-
end
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
after do
|
|
197
|
-
Foo.instance_variable_set("@database_config", nil) # resets the memoization
|
|
198
|
-
end
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
describe "#database_config" do
|
|
202
|
-
it "should memoize the results" do
|
|
203
|
-
expect(Foo.database_config).to eq(config['test'])
|
|
204
|
-
config['username'] = 'newuser'
|
|
205
|
-
expect(Foo.database_config).to eq(config['test'])
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
context 'for missing database config file' do
|
|
209
|
-
before { allow(File).to receive(:exist?).and_return( false) }
|
|
210
|
-
|
|
211
|
-
it "raises error" do
|
|
212
|
-
expect { Foo.database_config }.to raise_error(RuntimeError)
|
|
213
|
-
end
|
|
214
|
-
end
|
|
215
|
-
end
|
|
216
|
-
end
|
|
217
|
-
end
|