Skip to content

Commit b2572af

Browse files
committed
🔧 Configure les tests pour captive-theme
1 parent c638b65 commit b2572af

60 files changed

Lines changed: 1165 additions & 24 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Gemfile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ end
2424

2525
group :development, :test do
2626
gem "rubocop-config-captive", "~> 1.6.0"
27+
gem "rspec-rails", "~> 6.0.0"
2728
end
2829

2930
# rubocop:enable Captive/Translation/RailsI18nPresence

‎Gemfile.lock‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ PATH
1313
captive-api (= 0.1.0.alpha)
1414
captive-theme (= 0.1.0.alpha)
1515
captive-theme (0.1.0.alpha)
16+
formtastic (~> 3.1, >= 3.1.4)
1617

1718
GEM
1819
remote: https://rubygems.org/
@@ -90,6 +91,8 @@ GEM
9091
date (3.3.3)
9192
diff-lcs (1.5.0)
9293
erubi (1.12.0)
94+
formtastic (3.1.5)
95+
actionpack (>= 3.2.13)
9396
globalid (1.1.0)
9497
activesupport (>= 5.0)
9598
i18n (1.14.1)
@@ -176,6 +179,14 @@ GEM
176179
rspec-mocks (3.12.6)
177180
diff-lcs (>= 1.2.0, < 2.0)
178181
rspec-support (~> 3.12.0)
182+
rspec-rails (6.0.3)
183+
actionpack (>= 6.1)
184+
activesupport (>= 6.1)
185+
railties (>= 6.1)
186+
rspec-core (~> 3.12)
187+
rspec-expectations (~> 3.12)
188+
rspec-mocks (~> 3.12)
189+
rspec-support (~> 3.12)
179190
rspec-support (3.12.1)
180191
rubocop (1.51.0)
181192
json (~> 2.3)
@@ -238,6 +249,7 @@ DEPENDENCIES
238249
rails (~> 7.0.6)
239250
rspec (~> 3.12.0)
240251
rspec-mocks (~> 3.12.6)
252+
rspec-rails (~> 6.0.0)
241253
rubocop-config-captive (~> 1.6.0)
242254
sqlite3 (~> 1.6.3)
243255
yard (~> 0.9.34)

‎captive-theme/.rspec‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--require spec_helper

‎captive-theme/Rakefile‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
require "bundler/setup"
22

3-
require "bundler/gem_tasks"
4-
require "rspec/core/rake_task"
3+
APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
4+
load "rails/tasks/engine.rake"
5+
6+
load "rails/tasks/statistics.rake"
57

6-
RSpec::Core::RakeTask.new(:spec)
8+
require "bundler/gem_tasks"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class IconFileInput < ImageFileInput
22
def image_preview_html_options
33
options = super
4-
options[:class] ||= ''
5-
options[:class] += ' icon-preview'
4+
options[:class] ||= ""
5+
options[:class] += " icon-preview"
66
options
77
end
88
end

‎captive-theme/app/inputs/image_file_input.rb‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ def image_preview_html
1111
if object.send(method)&.attached?
1212
builder.template.image_tag(object.send(method), image_preview_html_options)
1313
else
14-
''
14+
""
1515
end
1616
end
1717

1818
def input_html_options
1919
{
20-
accept: 'image/*',
20+
accept: "image/*",
2121
}.merge(super)
2222
end
2323

2424
def image_preview_html_options
25-
options[:image_preview_html] ||= { style: 'max-width: 100%;' }
25+
options[:image_preview_html] ||= { style: "max-width: 100%;" }
2626
end
2727
end

‎captive-theme/bin/rails‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env ruby
2+
# This command will automatically be run when you run "rails" with Rails gems
3+
# installed from the root of your application.
4+
5+
ENGINE_ROOT = File.expand_path("..", __dir__)
6+
ENGINE_PATH = File.expand_path("../lib/captive/theme/engine", __dir__)
7+
APP_PATH = File.expand_path("../spec/dummy/config/application", __dir__)
8+
9+
# Set up gems listed in the Gemfile.
10+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
11+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
12+
13+
require "rails"
14+
# Pick the frameworks you want:
15+
require "active_model/railtie"
16+
require "active_job/railtie"
17+
require "active_record/railtie"
18+
require "active_storage/engine"
19+
require "action_controller/railtie"
20+
require "action_mailer/railtie"
21+
require "action_mailbox/engine"
22+
require "action_text/engine"
23+
require "action_view/railtie"
24+
require "action_cable/engine"
25+
# require "rails/test_unit/railtie"
26+
require "rails/engine/commands"

‎captive-theme/bin/test‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎captive-theme/captive-theme.gemspec‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,9 @@ Gem::Specification.new do |spec|
2121
Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
2222
end
2323

24-
# spec.add_dependency "rails", ">= 7.1.0.alpha"
24+
spec.add_dependency "formtastic", "~> 3.1", ">= 3.1.4"
25+
26+
spec.add_development_dependency "rspec-rails"
27+
spec.add_development_dependency "rspec-mocks"
28+
spec.add_development_dependency "rails-dummy"
2529
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require "rails"
2+
3+
module Captive
4+
module Theme
5+
class Engine < ::Rails::Engine
6+
# require "formtastic"
7+
# require "app/inputs/icon_file_input.rb"
8+
9+
config.generators do |g|
10+
g.test_framework :rspec
11+
end
12+
end
13+
end
14+
end

0 commit comments

Comments
 (0)