Skip to content

Commit f2910a7

Browse files
committed
🔧 Configure les tests pour captive-theme
1 parent 9680e3d commit f2910a7

59 files changed

Lines changed: 1152 additions & 23 deletions

Some content is hidden

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

‎Gemfile.lock‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ PATH
2121
captive-authentication (= 0.2.8)
2222
captive-theme (= 0.2.8)
2323
captive-theme (0.2.8)
24+
formtastic (~> 3.1, >= 3.1.4)
2425

2526
GEM
2627
remote: https://rubygems.org/
@@ -132,6 +133,8 @@ GEM
132133
factory_bot_rails (6.2.0)
133134
factory_bot (~> 6.2.0)
134135
railties (>= 5.0.0)
136+
formtastic (3.1.5)
137+
actionpack (>= 3.2.13)
135138
globalid (1.2.1)
136139
activesupport (>= 6.1)
137140
hashdiff (1.0.1)

‎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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
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"
55

66
RSpec::Core::RakeTask.new(:spec)
77

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
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<%%= semantic_form_for @<%= singular_name %> do |f| %>
2+
<%%= f.inputs do %>
3+
<%- attributes.each do |attribute| -%>
4+
<%%= f.input :<%= attribute.name %> %>
5+
<%- end -%>
6+
<%% end %>
7+
8+
<%%= f.actions do %>
9+
<%%= f.action :submit, :as => :input %>
10+
<%% end %>
11+
<%% end %>

0 commit comments

Comments
 (0)