Skip to content

Commit 62c7ad2

Browse files
committed
Add minimum specs
1 parent 141fd1c commit 62c7ad2

7 files changed

Lines changed: 83 additions & 0 deletions

File tree

.rspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--require rails_helper
2+
--format documentation
3+
--profile

lib/activeadmin_blaze_theme.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# frozen_string_literal: true
22

3+
require 'activeadmin'
34
require 'activeadmin/views/activeadmin_form'
45
require 'activeadmin_blaze_theme/version'
56
# require 'formtastic/inputs/blaze_array_input'

spec/rails_helper.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
ENV['RAILS_ENV'] = 'test'
6+
7+
require File.expand_path('dummy/config/environment.rb', __dir__)
8+
9+
abort('The Rails environment is running in production mode!') if Rails.env.production?
10+
11+
require 'rspec/rails'
12+
require 'capybara/rails'
13+
14+
Dir[File.expand_path('support/**/*.rb', __dir__)].sort.each { |f| require f }
15+
16+
# Force deprecations to raise an exception.
17+
ActiveSupport::Deprecation.behavior = :raise
18+
19+
# Checks for pending migrations and applies them before tests are run.
20+
# If you are not using ActiveRecord, you can remove these lines.
21+
begin
22+
ActiveRecord::Migration.maintain_test_schema!
23+
rescue ActiveRecord::PendingMigrationError => e
24+
puts e.to_s.strip
25+
exit 1
26+
end
27+
28+
RSpec.configure do |config|
29+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
30+
config.infer_spec_type_from_file_location!
31+
config.filter_rails_from_backtrace!
32+
33+
config.use_transactional_fixtures = true
34+
config.use_instantiated_fixtures = false
35+
config.render_views = false
36+
end

spec/spec_helper.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.configure do |config|
4+
config.disable_monkey_patching!
5+
config.filter_run focus: true
6+
config.filter_run_excluding changes_filesystem: true
7+
config.run_all_when_everything_filtered = true
8+
config.color = true
9+
config.order = :random
10+
config.example_status_persistence_file_path = '.rspec_failures'
11+
config.shared_context_metadata_behavior = :apply_to_host_groups
12+
13+
config.expect_with :rspec do |expectations|
14+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
15+
end
16+
17+
config.mock_with :rspec do |mocks|
18+
mocks.verify_partial_doubles = true
19+
end
20+
end

spec/support/capybara.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# frozen_string_literal: true
2+
3+
Capybara.server = :puma

spec/support/drivers.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.configure do |config|
4+
config.before(:each, type: :system) do
5+
driven_by(:selenium_chrome_headless)
6+
end
7+
end

spec/system/theme_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.describe 'Theme', type: :system do
4+
it 'checks that the theme is loaded' do
5+
visit '/admin/posts'
6+
7+
expect(page).to have_css('body.active_admin', style: { 'font-size': '12px' })
8+
expect(page).to have_css('body.active_admin a', text: /new post/i, style: { 'background-image': 'none' })
9+
expect(page).to have_css('body.active_admin #header', style: { 'background-image': 'none' })
10+
expect(page).to have_css('body.active_admin #title_bar', style: { 'box-shadow': 'none' })
11+
expect(page).to have_css('body.active_admin #main_content', style: { 'padding': '25px 20px' })
12+
end
13+
end

0 commit comments

Comments
 (0)