spina-admin-conferences-blog 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +42 -0
- data/Rakefile +34 -0
- data/app/assets/config/spina_admin_conferences_blog_manifest.js +0 -0
- data/app/controllers/spina/admin/conferences/blog/categories_controller.rb +80 -0
- data/app/controllers/spina/admin/conferences/blog/posts_controller.rb +103 -0
- data/app/decorators/spina/admin/conferences/blog/post_decorator.rb +26 -0
- data/app/helpers/spina/admin/conferences/blog/posts_helper.rb +18 -0
- data/app/models/spina/admin/conferences/blog/application_record.rb +12 -0
- data/app/models/spina/admin/conferences/blog/category.rb +23 -0
- data/app/models/spina/admin/conferences/blog/post.rb +52 -0
- data/app/models/spina/admin/conferences/blog.rb +10 -0
- data/app/views/layouts/spina/admin/conferences/blog/blog.html.haml +29 -0
- data/app/views/layouts/spina/admin/conferences/blog/categories.html.haml +10 -0
- data/app/views/spina/admin/conferences/blog/categories/_category.html.haml +8 -0
- data/app/views/spina/admin/conferences/blog/categories/_form.html.haml +42 -0
- data/app/views/spina/admin/conferences/blog/categories/edit.html.haml +3 -0
- data/app/views/spina/admin/conferences/blog/categories/index.html.haml +23 -0
- data/app/views/spina/admin/conferences/blog/categories/new.html.haml +2 -0
- data/app/views/spina/admin/conferences/blog/posts/_form.html.haml +43 -0
- data/app/views/spina/admin/conferences/blog/posts/_form_post_configuration.html.haml +50 -0
- data/app/views/spina/admin/conferences/blog/posts/_form_post_content.html.haml +46 -0
- data/app/views/spina/admin/conferences/blog/posts/_form_post_seo.html.haml +14 -0
- data/app/views/spina/admin/conferences/blog/posts/_post.html.haml +19 -0
- data/app/views/spina/admin/conferences/blog/posts/edit.html.haml +3 -0
- data/app/views/spina/admin/conferences/blog/posts/index.html.haml +23 -0
- data/app/views/spina/admin/conferences/blog/posts/new.html.haml +2 -0
- data/app/views/spina/admin/hooks/conferences/blog/_primary_navigation.html.haml +10 -0
- data/config/initializers/friendly_id.rb +94 -0
- data/config/locales/en.yml +41 -0
- data/config/locales/nl.yml +42 -0
- data/config/locales/pt-BR.yml +41 -0
- data/config/routes.rb +32 -0
- data/db/migrate/1_create_spina_blog_posts.rb +18 -0
- data/db/migrate/2_create_spina_blog_friendly_id_slugs.rb +19 -0
- data/db/migrate/3_create_spina_blog_categories.rb +12 -0
- data/db/migrate/4_add_category_id_to_spina_blog_posts.rb +7 -0
- data/db/migrate/5_add_featured_to_spina_blog_posts.rb +9 -0
- data/db/migrate/6_add_seo_fields.rb +11 -0
- data/lib/generators/spina_admin_conferences_blog/install_generator.rb +24 -0
- data/lib/spina/admin/conferences/blog/configuration.rb +17 -0
- data/lib/spina/admin/conferences/blog/engine.rb +24 -0
- data/lib/spina/admin/conferences/blog/version.rb +8 -0
- data/lib/spina/admin/conferences/blog.rb +18 -0
- data/lib/spina/admin/conferences.rb +6 -0
- data/lib/spina/admin.rb +5 -0
- data/lib/tasks/spina/admin/conferences/blog_tasks.rake +14 -0
- data/spec/controllers/spina/admin/conferences/blog/categories_controller_spec.rb +99 -0
- data/spec/controllers/spina/admin/conferences/blog/posts_controller_spec.rb +152 -0
- data/spec/dummy/Rakefile +8 -0
- data/spec/dummy/app/assets/config/manifest.js +4 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/assets/stylesheets/default/application.css.sass +0 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +6 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +6 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +4 -0
- data/spec/dummy/app/jobs/application_job.rb +4 -0
- data/spec/dummy/app/mailers/application_mailer.rb +6 -0
- data/spec/dummy/app/models/application_record.rb +6 -0
- data/spec/dummy/app/views/default/pages/homepage.html.haml +2 -0
- data/spec/dummy/app/views/default/pages/show.html.haml +3 -0
- data/spec/dummy/app/views/default/shared/_navigation.html.haml +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/layouts/default/application.html.haml +11 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +5 -0
- data/spec/dummy/bin/rails +6 -0
- data/spec/dummy/bin/rake +6 -0
- data/spec/dummy/bin/setup +36 -0
- data/spec/dummy/bin/update +31 -0
- data/spec/dummy/config/application.rb +16 -0
- data/spec/dummy/config/boot.rb +7 -0
- data/spec/dummy/config/cable.yml +9 -0
- data/spec/dummy/config/database.yml +17 -0
- data/spec/dummy/config/environment.rb +7 -0
- data/spec/dummy/config/environments/development.rb +56 -0
- data/spec/dummy/config/environments/production.rb +88 -0
- data/spec/dummy/config/environments/test.rb +44 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy/config/initializers/assets.rb +13 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +9 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
- data/spec/dummy/config/initializers/inflections.rb +18 -0
- data/spec/dummy/config/initializers/mime_types.rb +6 -0
- data/spec/dummy/config/initializers/mobility.rb +16 -0
- data/spec/dummy/config/initializers/new_framework_defaults.rb +25 -0
- data/spec/dummy/config/initializers/session_store.rb +5 -0
- data/spec/dummy/config/initializers/spina.rb +22 -0
- data/spec/dummy/config/initializers/themes/default.rb +32 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +16 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/puma.rb +49 -0
- data/spec/dummy/config/routes.rb +6 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config/spring.rb +8 -0
- data/spec/dummy/config.ru +7 -0
- data/spec/dummy/db/migrate/20190513103729_create_spina_tables.spina.rb +132 -0
- data/spec/dummy/db/migrate/20190513103730_create_spina_translation_tables.spina.rb +46 -0
- data/spec/dummy/db/migrate/20190513103731_create_spina_navigations.spina.rb +24 -0
- data/spec/dummy/db/migrate/20190513103732_add_password_reset_token_to_spina_users.spina.rb +9 -0
- data/spec/dummy/db/migrate/20190513103733_remove_translated_columns.spina.rb +14 -0
- data/spec/dummy/db/migrate/20190513103734_create_spina_options.spina.rb +11 -0
- data/spec/dummy/db/migrate/20190513103735_create_spina_settings.spina.rb +14 -0
- data/spec/dummy/db/migrate/20190513103736_create_spina_media_folders.spina.rb +11 -0
- data/spec/dummy/db/migrate/20190513103737_create_spina_images.spina.rb +13 -0
- data/spec/dummy/db/migrate/20190513103738_create_spina_image_collections.spina.rb +17 -0
- data/spec/dummy/db/migrate/20190513103739_create_spina_resources.spina.rb +18 -0
- data/spec/dummy/db/schema.rb +288 -0
- data/spec/dummy/db/seeds.rb +4 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/spina/admin/conferences/blog/categories.rb +11 -0
- data/spec/factories/spina/admin/conferences/blog/posts.rb +16 -0
- data/spec/models/spina/admin/conferences/blog/category_spec.rb +21 -0
- data/spec/models/spina/admin/conferences/blog/post_spec.rb +39 -0
- data/spec/rails_helper.rb +68 -0
- data/spec/spec_helper.rb +97 -0
- data/spec/support/capybara.rb +25 -0
- data/spec/support/controller_helpers.rb +25 -0
- data/spec/support/controller_routes.rb +13 -0
- data/spec/support/factory_bot.rb +5 -0
- data/spec/support/rails_controller_testing.rb +13 -0
- data/spec/support/system_tests.rb +11 -0
- data/spec/system/spina/admin/conferences/blog/posts_spec.rb +34 -0
- data/spec/system/support/image.png +0 -0
- metadata +508 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_helper'
|
4
|
+
|
5
|
+
module Spina::Admin::Conferences::Blog
|
6
|
+
RSpec.describe Post, type: :model do
|
7
|
+
let(:post) { build(:spina_blog_post) }
|
8
|
+
|
9
|
+
subject { post }
|
10
|
+
|
11
|
+
it { is_expected.to be_valid }
|
12
|
+
it { expect { post.save }.to change(Spina::Admin::Conferences::Blog::Post, :count).by(1) }
|
13
|
+
|
14
|
+
context 'with invalid attributes' do
|
15
|
+
let(:post) { build(:invalid_spina_blog_post) }
|
16
|
+
|
17
|
+
it { is_expected.to_not be_valid }
|
18
|
+
it { expect { post.save }.to_not change(Spina::Admin::Conferences::Blog::Post, :count) }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '.featured' do
|
22
|
+
let!(:post) { create(:spina_blog_post, featured: true) }
|
23
|
+
let!(:unfeatured) { create(:spina_blog_post) }
|
24
|
+
|
25
|
+
it 'returns 1 result' do
|
26
|
+
expect(Spina::Admin::Conferences::Blog::Post.featured).to match_array [post]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '.unfeatured' do
|
31
|
+
let!(:post) { create(:spina_blog_post, featured: true) }
|
32
|
+
let!(:unfeatured) { create(:spina_blog_post) }
|
33
|
+
|
34
|
+
it 'returns 1 result' do
|
35
|
+
expect(Spina::Admin::Conferences::Blog::Post.unfeatured).to match_array [unfeatured]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start 'rails'
|
5
|
+
|
6
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
7
|
+
require 'spec_helper'
|
8
|
+
ENV['RAILS_ENV'] ||= 'test'
|
9
|
+
require File.expand_path('dummy/config/environment.rb', __dir__)
|
10
|
+
ActiveRecord::Migrator.migrations_paths = [File.expand_path('dummy/db/migrate', __dir__)]
|
11
|
+
# Prevent database truncation if the environment is production
|
12
|
+
abort('The Rails environment is running in production mode!') if Rails.env.production?
|
13
|
+
require 'rspec/rails'
|
14
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
15
|
+
require 'factory_bot_rails'
|
16
|
+
require 'capybara/rails'
|
17
|
+
require 'capybara/rspec'
|
18
|
+
require 'webdrivers'
|
19
|
+
|
20
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
21
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
22
|
+
# run as spec files by default. This means that files in spec/support that end
|
23
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
24
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
25
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
26
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
27
|
+
#
|
28
|
+
# The following line is provided for convenience purposes. It has the downside
|
29
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
30
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
31
|
+
# require only the support files necessary.
|
32
|
+
#
|
33
|
+
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
34
|
+
Dir[File.expand_path('../spec/support/**/*.rb', __dir__)].each { |f| require f }
|
35
|
+
|
36
|
+
# Checks for pending migration and applies them before tests are run.
|
37
|
+
# If you are not using ActiveRecord, you can remove this line.
|
38
|
+
ActiveRecord::Migration.maintain_test_schema!
|
39
|
+
|
40
|
+
RSpec.configure do |config|
|
41
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
42
|
+
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
43
|
+
|
44
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
45
|
+
# examples within a transaction, remove the following line or assign false
|
46
|
+
# instead of true.
|
47
|
+
config.use_transactional_fixtures = true
|
48
|
+
|
49
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
50
|
+
# based on their file location, for example enabling you to call `get` and
|
51
|
+
# `post` in specs under `spec/controllers`.
|
52
|
+
#
|
53
|
+
# You can disable this behaviour by removing the line below, and instead
|
54
|
+
# explicitly tag your specs with their type, e.g.:
|
55
|
+
#
|
56
|
+
# RSpec.describe UsersController, :type => :controller do
|
57
|
+
# # ...
|
58
|
+
# end
|
59
|
+
#
|
60
|
+
# The different available types are documented in the features, such as in
|
61
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
62
|
+
config.infer_spec_type_from_file_location!
|
63
|
+
|
64
|
+
# Filter lines from Rails gems in backtraces.
|
65
|
+
config.filter_rails_from_backtrace!
|
66
|
+
# arbitrary gems may also be filtered via:
|
67
|
+
# config.filter_gems_from_backtrace("gem name")
|
68
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
6
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
7
|
+
# files.
|
8
|
+
#
|
9
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
10
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
11
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
12
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
13
|
+
# a separate helper file that requires the additional dependencies and performs
|
14
|
+
# the additional setup, and require it from the spec files that actually need
|
15
|
+
# it.
|
16
|
+
#
|
17
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
18
|
+
RSpec.configure do |config|
|
19
|
+
# rspec-expectations config goes here. You can use an alternate
|
20
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
21
|
+
# assertions if you prefer.
|
22
|
+
config.expect_with :rspec do |expectations|
|
23
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
24
|
+
# and `failure_message` of custom matchers include text for helper methods
|
25
|
+
# defined using `chain`, e.g.:
|
26
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
27
|
+
# # => "be bigger than 2 and smaller than 4"
|
28
|
+
# ...rather than:
|
29
|
+
# # => "be bigger than 2"
|
30
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
31
|
+
end
|
32
|
+
|
33
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
34
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
35
|
+
config.mock_with :rspec do |mocks|
|
36
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
37
|
+
# a real object. This is generally recommended, and will default to
|
38
|
+
# `true` in RSpec 4.
|
39
|
+
mocks.verify_partial_doubles = true
|
40
|
+
end
|
41
|
+
|
42
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
43
|
+
# have no way to turn it off -- the option exists only for backwards
|
44
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
45
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
46
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
47
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
48
|
+
|
49
|
+
# The settings below are suggested to provide a good initial experience
|
50
|
+
# with RSpec, but feel free to customize to your heart's content.
|
51
|
+
|
52
|
+
# This allows you to limit a spec run to individual examples or groups
|
53
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
54
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
55
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
56
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
57
|
+
config.filter_run_when_matching :focus
|
58
|
+
|
59
|
+
# Allows RSpec to persist some state between runs in order to support
|
60
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
61
|
+
# you configure your source control system to ignore this file.
|
62
|
+
config.example_status_persistence_file_path = 'spec/examples.txt'
|
63
|
+
|
64
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
65
|
+
# recommended. For more details, see:
|
66
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
67
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
68
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
69
|
+
config.disable_monkey_patching!
|
70
|
+
|
71
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
72
|
+
# file, and it's useful to allow more verbose output when running an
|
73
|
+
# individual spec file.
|
74
|
+
if config.files_to_run.one?
|
75
|
+
# Use the documentation formatter for detailed output,
|
76
|
+
# unless a formatter has already been configured
|
77
|
+
# (e.g. via a command-line flag).
|
78
|
+
config.default_formatter = 'doc'
|
79
|
+
end
|
80
|
+
|
81
|
+
# Print the 10 slowest examples and example groups at the
|
82
|
+
# end of the spec run, to help surface which specs are running
|
83
|
+
# particularly slow.
|
84
|
+
config.profile_examples = 10
|
85
|
+
|
86
|
+
# Run specs in random order to surface order dependencies. If you find an
|
87
|
+
# order dependency and want to debug it, you can fix the order by providing
|
88
|
+
# the seed, which is printed after each run.
|
89
|
+
# --seed 1234
|
90
|
+
config.order = :random
|
91
|
+
|
92
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
93
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
94
|
+
# test failures related to randomization by passing the same `--seed` value
|
95
|
+
# as the one that triggered the failure.
|
96
|
+
Kernel.srand config.seed
|
97
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Capybara.server = :puma, { Silent: true }
|
4
|
+
|
5
|
+
args = %w[disable-dev-shm-usage no-sandbox disable-gpu window-size=1280,1024]
|
6
|
+
args << "lang=#{I18n.locale}"
|
7
|
+
args << 'headless' unless ENV['DEBUG']
|
8
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
9
|
+
chromeOptions: { args: args }
|
10
|
+
)
|
11
|
+
|
12
|
+
Capybara.register_driver :chrome do |app|
|
13
|
+
Capybara::Selenium::Driver.new(
|
14
|
+
app, browser: :chrome, desired_capabilities: capabilities
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
Capybara.register_driver :selenium_remote do |app|
|
19
|
+
Capybara::Selenium::Driver.new(
|
20
|
+
app,
|
21
|
+
browser: :remote,
|
22
|
+
desired_capabilities: capabilities,
|
23
|
+
url: 'http://selenium:4444/wd/hub'
|
24
|
+
)
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ControllerHelpers
|
4
|
+
def sign_in
|
5
|
+
@account = Spina::Account.create name: 'My Website', preferences: { theme: 'default' }
|
6
|
+
@user = Spina::User.create name: 'admin', email: 'admin@example.com', password: 'password', admin: true
|
7
|
+
request.session[:user_id] = @user.id
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module FeatureHelpers
|
12
|
+
def sign_in
|
13
|
+
@account = Spina::Account.create name: 'My Website', preferences: { theme: 'default' }
|
14
|
+
@user = Spina::User.create name: 'admin', email: 'admin@example.com', password: 'password', admin: true
|
15
|
+
visit '/admin/login'
|
16
|
+
fill_in :email, with: @user.email
|
17
|
+
fill_in :password, with: 'password'
|
18
|
+
click_button 'Login'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
RSpec.configure do |config|
|
23
|
+
config.include ControllerHelpers, type: :controller
|
24
|
+
config.include FeatureHelpers, type: :system
|
25
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails-controller-testing'
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
%i[controller view request].each do |type|
|
7
|
+
config.include ::Rails::Controller::Testing::TestProcess, type: type
|
8
|
+
config.include ::Rails::Controller::Testing::TemplateAssertions, type: type
|
9
|
+
config.include ::Rails::Controller::Testing::Integration, type: type
|
10
|
+
end
|
11
|
+
|
12
|
+
config.include ::Rails::Controller::Testing::TemplateAssertions, type: :helper
|
13
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_helper'
|
4
|
+
|
5
|
+
RSpec.feature 'Admin Posts', type: :system do
|
6
|
+
before { sign_in }
|
7
|
+
|
8
|
+
describe 'listing posts' do
|
9
|
+
let!(:posts) { create_list(:spina_blog_post, 3, published_at: Date.today + 1) }
|
10
|
+
|
11
|
+
it 'shows all the posts' do
|
12
|
+
visit '/admin/conferences/blog/posts'
|
13
|
+
expect(page).to have_css 'tbody tr', count: 3
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'creating a post' do
|
18
|
+
it 'creates a post', js: true do
|
19
|
+
visit '/admin/conferences/blog/posts'
|
20
|
+
click_on 'New Post'
|
21
|
+
fill_in 'Post title', with: 'Title of Blog post'
|
22
|
+
find(
|
23
|
+
:css, 'trix-editor[input*="content_input"]'
|
24
|
+
).set('Foobar')
|
25
|
+
click_on 'Save post'
|
26
|
+
within '#header' do
|
27
|
+
click_on 'Posts'
|
28
|
+
end
|
29
|
+
within 'tbody' do
|
30
|
+
expect(page).to have_content 'Title of Blog post'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
Binary file
|