bootstrap-honoka-rails 4.3.1.1 → 4.4.1.0

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.
@@ -1,17 +1,14 @@
1
1
  require_relative 'boot'
2
2
 
3
- require 'rails/all'
4
- require 'jquery-rails'
5
- require 'sprockets'
6
- require 'turbolinks'
7
-
8
- Bundler.require(*Rails.groups)
3
+ # rails require exclude active record
4
+ require "rails"
5
+ Bundler.require(*Rails.groups << :development)
9
6
 
10
7
  module Dummy
11
8
  class Application < Rails::Application
12
9
  # Initialize configuration defaults for originally generated Rails version.
13
10
  config.load_defaults 5.2
14
-
11
+ config.hosts.clear
15
12
  # Settings in config/environments/* take precedence over those specified here.
16
13
  # Application configuration can go into files in config/initializers
17
14
  # -- all .rb files in that directory are automatically loaded after loading
@@ -15,7 +15,7 @@ Rails.application.configure do
15
15
  # Configure public file server for tests with Cache-Control for performance.
16
16
  config.public_file_server.enabled = true
17
17
  config.public_file_server.headers = {
18
- 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
18
+ 'Cache-Control' => "public, max-age=180"
19
19
  }
20
20
 
21
21
  # Show full error reports and disable caching.
@@ -1,6 +1,5 @@
1
1
  Rails.application.routes.draw do
2
- get 'pages/honoka'
3
- get 'pages/umi'
4
- get 'pages/nico'
5
- get 'pages/rin'
2
+ ::Bootstrap::Honoka::Rails::STYLE_SHEETS.each do |s|
3
+ get "pages/#{s}"
4
+ end
6
5
  end
File without changes
data/test/honoka_test.rb CHANGED
@@ -1,10 +1,47 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class Bootstrap::Honoka::Rails::Test < ActionDispatch::IntegrationTest
4
- %w[honoka].each do |name|
5
- test "access #{name} test" do
6
- get "/pages/#{name}"
7
- assert_response :success
4
+ # Mix-in
5
+ include DummyIntegration
6
+
7
+ # constant data variables
8
+ TEST_PAGES = ::Bootstrap::Honoka::Rails::STYLE_SHEETS
9
+ TEST_PATHS = TEST_PAGES.map { |el| "/pages/#{el}".freeze }.freeze
10
+ TEST_DATAS = TEST_PAGES.zip(TEST_PATHS).map(&:freeze).freeze
11
+
12
+ # スタイルシートの個数確認
13
+ test 'stylesheet count' do
14
+ # スタイルシート数の確認
15
+ assert !TEST_PAGES.empty?, 'エラー:サポートされているスタイルシートが1つも存在していません。'
16
+ end
17
+
18
+ # access test
19
+ TEST_DATAS.each do |page, path|
20
+ test "access #{page}" do
21
+ begin
22
+ # ページのアクセステスト
23
+ visit path
24
+
25
+ # ステータスコードの取得を行う
26
+ # https://stackoverflow.com/questions/7908907/how-to-test-the-response-code-with-capybara-selenium
27
+ response_code = Capybara.page.first('html')[:code].to_i
28
+ assert response_code == 200, 'エラー:正しくページを取得できませんでした。'
29
+ ensure
30
+ # エラーであっても表示ページのscreenshotは撮る。
31
+ take_full_page_screenshot!
32
+ end
33
+ end
34
+ end
35
+
36
+ # compile test
37
+ TEST_PAGES.each do |page|
38
+ test "compile #{page}" do
39
+ # Sassのコンパイルを行う
40
+ SassC::Engine.new("@import '_#{page}';",
41
+ load_paths: app.config.assets.paths).render
42
+
43
+ # 例外が発生せずここまで来れば assert成功
44
+ assert true
8
45
  end
9
46
  end
10
47
  end
@@ -0,0 +1,57 @@
1
+ # require files
2
+ require 'fileutils'
3
+
4
+ # DummyIntegration
5
+ module DummyIntegration
6
+ # Capybara系のヘルパーメソッド
7
+
8
+ # Mix-in
9
+ include Capybara::DSL
10
+ include Capybara::Minitest::Assertions
11
+
12
+ def setup
13
+ super
14
+ cleanup_cache_files
15
+ end
16
+
17
+ def teardown
18
+ super
19
+ Capybara.reset_sessions!
20
+ Capybara.use_default_driver
21
+ end
22
+
23
+ private
24
+
25
+ def cleanup_cache_files
26
+ FileUtils.rm_rf('test/dummy/tmp/cache', secure: true)
27
+ end
28
+
29
+ def screenshot_to_file!(path, log_append = '')
30
+ # save screenshot!
31
+ page.save_screenshot File.join(ROOT_PATH, path)
32
+ ::Minitest::Reporters::DummyReporter.log_strings_append! "Screenshot: Saved to #{path} #{log_append}"
33
+ end
34
+
35
+ # screenshotを撮る
36
+ def screenshot!
37
+ # パスを設定してファイルを保存する。
38
+ path = "tmp/#{name}.png"
39
+ screenshot_to_file! path
40
+ end
41
+
42
+ # 画面リサイズ後にscreenshotを撮る
43
+ def take_full_page_screenshot!
44
+ # https://testingrepository.com/full-page-screenshot-with-selenium/
45
+ # https://github.com/teampoltergeist/poltergeist/issues/165
46
+ # https://sqa.stackexchange.com/questions/9007/how-to-handle-time-out-receiving-message-from-the-renderer-in-chrome-driver
47
+
48
+ # 幅と高さを取得しブラウザのリサイズを行う。
49
+ width = Capybara.page.execute_script('return screen.width;')
50
+ height = Capybara.page.execute_script('return Math.max( document.body.scrollHeight , document.body.offsetHeight , document.documentElement.clientHeight , document.documentElement.scrollHeight , document.documentElement.offsetHeight );')
51
+ window = Capybara.current_session.driver.browser.manage.window
52
+ window.resize_to(width, height)
53
+
54
+ # スクリーンショットの保存
55
+ screenshot_to_file! "tmp/#{name}.png", "- W:H=#{width}:#{height}"
56
+ end
57
+ end
@@ -0,0 +1,61 @@
1
+ require 'minitest/reporters'
2
+
3
+ module Minitest
4
+ module Reporters
5
+ class DummyReporter < DefaultReporter
6
+ # 最後にログ出力する際の文字列配列(下記注意点)
7
+ #
8
+ # 1)特異メソッド内から下記変数を参照する為、クラス変数にするべきと思われるかもしれないが、
9
+ # 後にDummyReportersから継承される可能性を考慮すると、
10
+ # クラスインスタンス変数を使用する方が良いとの事。
11
+ # Effective Ruby 項目15
12
+ # 2)クラスインスタンス変数をクラスメソッドで使用する点から
13
+ # SingletonをIncludeする事も考慮したが、
14
+ # その場合
15
+ # ・Instanceメソッドからinitializeに引数が渡せない。
16
+ # ・どうしても親クラスのinitializeにデータを渡す際、
17
+ # def set_options( options = {} ); initialize(options); end;
18
+ # というようなRubyとして正か判断できないややこしい処理となりそうだった。
19
+ # (一般的に考えてコンストラクタを無理やり呼び出す違和感のあるやり方)
20
+ # という観点からSingletonは見送りとした。
21
+ @log_strings = []
22
+
23
+ # 特異メソッド
24
+ class << self
25
+ attr_reader :log_strings
26
+
27
+ def log_strings_append!(rhs)
28
+ @log_strings << rhs unless rhs.nil?
29
+ end
30
+ end
31
+
32
+ # 独自カラー
33
+ def cyan(string)
34
+ color? ? ANSI::Code.cyan(string) : string
35
+ end
36
+
37
+ def magenta(string)
38
+ color? ? ANSI::Code.magenta(string) : string
39
+ end
40
+
41
+ # レポートを行う
42
+ def on_report
43
+ super
44
+ return if self.class.log_strings.empty?
45
+
46
+ puts
47
+ puts cyan('------------------------------------------------------------')
48
+ puts magenta('[TEST INFO]')
49
+ self.class.log_strings.each do |data|
50
+ puts yellow(data)
51
+ end
52
+ puts cyan('------------------------------------------------------------')
53
+ puts
54
+ end
55
+ end
56
+
57
+ # セットアップ
58
+ reporter_options = { color: true }
59
+ ::Minitest::Reporters.use! [DummyReporter.new(reporter_options)]
60
+ end
61
+ end
data/test/test_helper.rb CHANGED
@@ -1,8 +1,52 @@
1
- require 'minitest/autorun'
2
- require 'minitest/reporters'
3
-
4
1
  # Configure Rails Environment
5
2
  ENV['RAILS_ENV'] = 'test'
6
3
 
7
- require_relative '../test/dummy/config/environment'
8
- require 'rails/test_help'
4
+ # require environment / rails / capybara
5
+ require_relative 'dummy/config/environment'
6
+ require 'rails/test_help' # 内部でminitestのautorunも行う。
7
+ require 'capybara/rails' # 内部でcapybara/dslもrequireする。
8
+ require 'capybara/minitest'
9
+
10
+ # settings
11
+ Webdrivers.cache_time = 10_000
12
+ ROOT_PATH = File.expand_path('../', File.dirname(__FILE__)).freeze
13
+
14
+ # support directory files require
15
+ Dir['test/support/**/*.rb'].each do |file|
16
+ require_relative File.join('.', file[5..-4])
17
+ end
18
+
19
+ # -----------------------------------------------------------------------------
20
+
21
+ # https://groups.google.com/forum/#!topic/chromedriver-users/ZBEju24L5ww
22
+
23
+ # Settings Selenium Timeout
24
+ client = Selenium::WebDriver::Remote::Http::Default.new
25
+ client.read_timeout = 1000 # 1000 second read wait
26
+
27
+ # Capybara driver settings
28
+ Capybara.register_driver :selenium_chrome_headless do |app|
29
+ Capybara::Selenium::Driver.load_selenium
30
+ browser_options = ::Selenium::WebDriver::Chrome::Options.new.tap do |opts|
31
+ opts.args << 'start-maximized'
32
+ opts.args << 'enable-automation'
33
+ opts.args << '--window-size=1200,768'
34
+ opts.args << '--headless'
35
+ opts.args << '--disable-gpu'
36
+ opts.args << '--no-sandbox'
37
+ opts.args << '--disable-infobars'
38
+ opts.args << '--disable-dev-shm-usage'
39
+ opts.args << '--disable-browser-side-navigation'
40
+ opts.args << '--disable-site-isolation-trials'
41
+ end
42
+ Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options, http_client: client)
43
+ end
44
+
45
+ # Capybara settings
46
+ Capybara.configure do |config|
47
+ config.server_port = 3000
48
+ config.app_host = "http://localhost:#{config.server_port}"
49
+ config.default_driver = :selenium_chrome_headless
50
+ config.javascript_driver = :selenium_chrome_headless
51
+ config.server = :webrick
52
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-honoka-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.1.1
4
+ version: 4.4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takmg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-01 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.3.1
19
+ version: 4.4.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 4.3.1
26
+ version: 4.4.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: capybara
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 3.20.2
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 3.20.2
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: jquery-rails
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,34 @@ dependencies:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: 1.3.6
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 3.7.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 3.7.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: sassc
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 2.0.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 2.0.0
69
111
  - !ruby/object:Gem::Dependency
70
112
  name: sprockets-rails
71
113
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +150,21 @@ dependencies:
108
150
  - - "~>"
109
151
  - !ruby/object:Gem::Version
110
152
  version: 4.1.20
111
- description: Gem to handle -Bootstrap honoka- easily
153
+ - !ruby/object:Gem::Dependency
154
+ name: webdrivers
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: 3.9.4
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: 3.9.4
167
+ description: Gem to handle -Bootstrap Honoka, Umi, Nico, Rin- easily
112
168
  email:
113
169
  - Takmg@example.com
114
170
  executables: []
@@ -117,6 +173,7 @@ extra_rdoc_files: []
117
173
  files:
118
174
  - MIT-LICENSE
119
175
  - README.md
176
+ - README_ja.md
120
177
  - Rakefile
121
178
  - VERSIONS.md
122
179
  - assets/stylesheets/_honoka.scss
@@ -147,16 +204,15 @@ files:
147
204
  - test/dummy/config/environments/production.rb
148
205
  - test/dummy/config/environments/test.rb
149
206
  - test/dummy/config/initializers/assets.rb
150
- - test/dummy/config/initializers/backtrace_silencers.rb
151
207
  - test/dummy/config/initializers/filter_parameter_logging.rb
152
- - test/dummy/config/initializers/inflections.rb
153
- - test/dummy/config/initializers/mime_types.rb
154
208
  - test/dummy/config/initializers/wrap_parameters.rb
155
209
  - test/dummy/config/locales/en.yml
156
210
  - test/dummy/config/routes.rb
157
211
  - test/dummy/package.json
158
- - test/dummy/production_key_generate.sh
212
+ - test/dummy/public/favicon.ico
159
213
  - test/honoka_test.rb
214
+ - test/support/dummy_integration.rb
215
+ - test/support/dummy_reporters.rb
160
216
  - test/test_helper.rb
161
217
  homepage: https://github.com/Takmg/bootstrap-honoka-rails
162
218
  licenses:
@@ -180,7 +236,7 @@ requirements: []
180
236
  rubygems_version: 3.0.3
181
237
  signing_key:
182
238
  specification_version: 4
183
- summary: Gem to handle -Bootstrap honoka- easily
239
+ summary: Gem to handle -Bootstrap Honoka, Umi, Nico, Rin- easily
184
240
  test_files:
185
241
  - test/dummy/Rakefile
186
242
  - test/dummy/app/assets/config/manifest.js
@@ -202,14 +258,13 @@ test_files:
202
258
  - test/dummy/config/environments/production.rb
203
259
  - test/dummy/config/environments/test.rb
204
260
  - test/dummy/config/initializers/assets.rb
205
- - test/dummy/config/initializers/backtrace_silencers.rb
206
261
  - test/dummy/config/initializers/filter_parameter_logging.rb
207
- - test/dummy/config/initializers/inflections.rb
208
- - test/dummy/config/initializers/mime_types.rb
209
262
  - test/dummy/config/initializers/wrap_parameters.rb
210
263
  - test/dummy/config/locales/en.yml
211
264
  - test/dummy/config/routes.rb
212
265
  - test/dummy/package.json
213
- - test/dummy/production_key_generate.sh
266
+ - test/dummy/public/favicon.ico
214
267
  - test/honoka_test.rb
268
+ - test/support/dummy_integration.rb
269
+ - test/support/dummy_reporters.rb
215
270
  - test/test_helper.rb
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,16 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format. Inflections
4
- # are locale specific, and you may define rules for as many different
5
- # locales as you wish. All of these examples are active by default:
6
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
- # inflect.plural /^(ox)$/i, '\1en'
8
- # inflect.singular /^(ox)en/i, '\1'
9
- # inflect.irregular 'person', 'people'
10
- # inflect.uncountable %w( fish sheep )
11
- # end
12
-
13
- # These inflection rules are supported but not enabled by default:
14
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
- # inflect.acronym 'RESTful'
16
- # end