much-rails 0.2.1 → 0.2.6
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.
- checksums.yaml +4 -4
- data/lib/much-rails.rb +1 -0
- data/lib/much-rails/abstract_class.rb +38 -0
- data/lib/much-rails/action/base_router.rb +10 -10
- data/lib/much-rails/action/router.rb +10 -4
- data/lib/much-rails/assets.rb +33 -18
- data/lib/much-rails/input_value.rb +1 -1
- data/lib/much-rails/service_validation_errors.rb +1 -1
- data/lib/much-rails/version.rb +1 -1
- data/much-rails.gemspec +2 -2
- data/test/unit/abstract_class_tests.rb +45 -0
- data/test/unit/action/base_router_tests.rb +10 -10
- data/test/unit/action/router_tests.rb +4 -4
- data/test/unit/assets_tests.rb +46 -14
- data/test/unit/input_value_tests.rb +10 -1
- metadata +10 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 604eda47d3d5c2f66e52716269d3652f8799c022187829e83c2815fcf22dfd11
         | 
| 4 | 
            +
              data.tar.gz: f765d10688da5b2a2aeb8827532806cf2c92a2bdf54fe8aedb2bcefc8304ffae
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2170ba5582c6f6eb88011b2188bcd69f89c57b05d0df8a56ab26678ab52409cda999cac0b129d1606a70770414d067f09d3b7c8702df6e451f89c40bb9079452
         | 
| 7 | 
            +
              data.tar.gz: a92cc7b6571d14e755ba60c4156c2daffe142c86c2204a60869c7d5f56130d7d265480884adc9a03dee4e90bdc07e148319593c53e900eefde62a32488c3bdf8
         | 
    
        data/lib/much-rails.rb
    CHANGED
    
    
| @@ -0,0 +1,38 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require "much-rails/mixin"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            # MuchRails::AbstractClass overrides the `new` class method to prevent a class
         | 
| 6 | 
            +
            # from being instantiated directly.
         | 
| 7 | 
            +
            module MuchRails::AbstractClass
         | 
| 8 | 
            +
              include MuchRails::Mixin
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              after_mixin_included do
         | 
| 11 | 
            +
                self.abstract_class = self
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                define_singleton_method(:new) do |*args, &block|
         | 
| 14 | 
            +
                  if abstract_class?
         | 
| 15 | 
            +
                    raise(
         | 
| 16 | 
            +
                      NotImplementedError,
         | 
| 17 | 
            +
                      "#{self} is an abstract class and cannot be instantiated.",
         | 
| 18 | 
            +
                    )
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  super(*args, &block)
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              mixin_class_methods do
         | 
| 26 | 
            +
                def abstract_class
         | 
| 27 | 
            +
                  @abstract_class
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                def abstract_class=(value)
         | 
| 31 | 
            +
                  @abstract_class = value
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                def abstract_class?
         | 
| 35 | 
            +
                  !!(abstract_class == self)
         | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
              end
         | 
| 38 | 
            +
            end
         | 
| @@ -70,8 +70,8 @@ class MuchRails::Action::BaseRouter | |
| 70 70 | 
             
              #       url :users, "/users", "Users::Index"
         | 
| 71 71 | 
             
              #     }
         | 
| 72 72 | 
             
              #   AdminRouter.path_for(:users) # => "/admin/users"
         | 
| 73 | 
            -
              def path_for(name,  | 
| 74 | 
            -
                @url_set.path_for(name,  | 
| 73 | 
            +
              def path_for(name, **kargs)
         | 
| 74 | 
            +
                @url_set.path_for(name, **kargs)
         | 
| 75 75 | 
             
              end
         | 
| 76 76 |  | 
| 77 77 | 
             
              # Example:
         | 
| @@ -87,8 +87,8 @@ class MuchRails::Action::BaseRouter | |
| 87 87 | 
             
              #       url :users, "/users", "Users::Index"
         | 
| 88 88 | 
             
              #     }
         | 
| 89 89 | 
             
              #   AdminRouter.url_for(:users) # => "http://example.org/admin/users"
         | 
| 90 | 
            -
              def url_for(name,  | 
| 91 | 
            -
                @url_set.url_for(name,  | 
| 90 | 
            +
              def url_for(name, **kargs)
         | 
| 91 | 
            +
                @url_set.url_for(name, **kargs)
         | 
| 92 92 | 
             
              end
         | 
| 93 93 |  | 
| 94 94 | 
             
              # Example:
         | 
| @@ -350,12 +350,12 @@ class MuchRails::Action::BaseRouter | |
| 350 350 | 
             
                  end
         | 
| 351 351 | 
             
                end
         | 
| 352 352 |  | 
| 353 | 
            -
                def path_for(name,  | 
| 354 | 
            -
                  fetch(name).path_for( | 
| 353 | 
            +
                def path_for(name, **kargs)
         | 
| 354 | 
            +
                  fetch(name).path_for(**kargs)
         | 
| 355 355 | 
             
                end
         | 
| 356 356 |  | 
| 357 | 
            -
                def url_for(name,  | 
| 358 | 
            -
                  fetch(name).url_for( | 
| 357 | 
            +
                def url_for(name, **kargs)
         | 
| 358 | 
            +
                  fetch(name).url_for(**kargs)
         | 
| 359 359 | 
             
                end
         | 
| 360 360 | 
             
              end
         | 
| 361 361 |  | 
| @@ -396,11 +396,11 @@ class MuchRails::Action::BaseRouter | |
| 396 396 | 
             
                  self.class.url_path(@router, @url_path)
         | 
| 397 397 | 
             
                end
         | 
| 398 398 |  | 
| 399 | 
            -
                def path_for( | 
| 399 | 
            +
                def path_for(**kargs)
         | 
| 400 400 | 
             
                  raise NotImplementedError
         | 
| 401 401 | 
             
                end
         | 
| 402 402 |  | 
| 403 | 
            -
                def url_for( | 
| 403 | 
            +
                def url_for(**kargs)
         | 
| 404 404 | 
             
                  raise NotImplementedError
         | 
| 405 405 | 
             
                end
         | 
| 406 406 |  | 
| @@ -90,12 +90,18 @@ class MuchRails::Action::Router < MuchRails::Action::BaseRouter | |
| 90 90 | 
             
              alias_method :draw, :apply_to
         | 
| 91 91 |  | 
| 92 92 | 
             
              class URL < MuchRails::Action::BaseRouter::BaseURL
         | 
| 93 | 
            -
                def path_for( | 
| 94 | 
            -
                  MuchRails::RailsRoutes.instance.public_send( | 
| 93 | 
            +
                def path_for(**kargs)
         | 
| 94 | 
            +
                  MuchRails::RailsRoutes.instance.public_send(
         | 
| 95 | 
            +
                    "#{name}_path",
         | 
| 96 | 
            +
                    **kargs.symbolize_keys,
         | 
| 97 | 
            +
                  )
         | 
| 95 98 | 
             
                end
         | 
| 96 99 |  | 
| 97 | 
            -
                def url_for( | 
| 98 | 
            -
                  MuchRails::RailsRoutes.instance.public_send( | 
| 100 | 
            +
                def url_for(**kargs)
         | 
| 101 | 
            +
                  MuchRails::RailsRoutes.instance.public_send(
         | 
| 102 | 
            +
                    "#{name}_url",
         | 
| 103 | 
            +
                    **kargs.symbolize_keys,
         | 
| 104 | 
            +
                  )
         | 
| 99 105 | 
             
                end
         | 
| 100 106 | 
             
              end
         | 
| 101 107 | 
             
            end
         | 
    
        data/lib/much-rails/assets.rb
    CHANGED
    
    | @@ -12,20 +12,16 @@ end | |
| 12 12 | 
             
            module MuchRails::Assets
         | 
| 13 13 | 
             
              def self.configure_for_rails(rails)
         | 
| 14 14 | 
             
                MuchRails::Assets.configure do |config|
         | 
| 15 | 
            -
                  # Cache fingerprints in memory for performance | 
| 16 | 
            -
                   | 
| 17 | 
            -
             | 
| 18 | 
            -
                   | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
                   | 
| 22 | 
            -
             | 
| 23 | 
            -
                     | 
| 24 | 
            -
             | 
| 25 | 
            -
                    else
         | 
| 26 | 
            -
                      MuchRails::Assets::NoCache.new
         | 
| 27 | 
            -
                    end
         | 
| 28 | 
            -
                  config.content_cache much_rails_content_cache
         | 
| 15 | 
            +
                  # Cache fingerprints/content in memory in non-development for performance
         | 
| 16 | 
            +
                  # gains. Don't cache in memory in developlemnt so changes are reflected
         | 
| 17 | 
            +
                  # without restarting the server.
         | 
| 18 | 
            +
                  if !rails.env.development?
         | 
| 19 | 
            +
                    config.fingerprint_cache MuchRails::Assets::MemCache.new
         | 
| 20 | 
            +
                    config.content_cache MuchRails::Assets::MemCache.new
         | 
| 21 | 
            +
                  else
         | 
| 22 | 
            +
                    config.fingerprint_cache MuchRails::Assets::NoCache.new
         | 
| 23 | 
            +
                    config.content_cache MuchRails::Assets::NoCache.new
         | 
| 24 | 
            +
                  end
         | 
| 29 25 |  | 
| 30 26 | 
             
                  # Cache out compiled file content to the public folder in non
         | 
| 31 27 | 
             
                  # development/test environments.
         | 
| @@ -33,21 +29,40 @@ module MuchRails::Assets | |
| 33 29 | 
             
                    config.file_store rails.root.join("public")
         | 
| 34 30 | 
             
                  end
         | 
| 35 31 |  | 
| 36 | 
            -
                  # Look for asset files in the app/assets folder. Support ERB | 
| 37 | 
            -
                  # on all . | 
| 38 | 
            -
                  config.source rails.root.join("app", "assets") do |s|
         | 
| 32 | 
            +
                  # Look for asset files in the app/assets/css folder. Support ERB
         | 
| 33 | 
            +
                  # on all .scss files. Support compilation of .scss files.
         | 
| 34 | 
            +
                  config.source rails.root.join("app", "assets", "css") do |s|
         | 
| 35 | 
            +
                    s.base_path "css"
         | 
| 36 | 
            +
             | 
| 39 37 | 
             
                    # Reject SCSS partials
         | 
| 40 38 | 
             
                    s.filter do |paths|
         | 
| 41 39 | 
             
                      paths.reject{ |p| File.basename(p) =~ /^_.*\.scss$/ }
         | 
| 42 40 | 
             
                    end
         | 
| 43 41 |  | 
| 44 | 
            -
                    s.engine "js",   MuchRails::Assets::Erubi::Engine
         | 
| 45 42 | 
             
                    s.engine "scss", MuchRails::Assets::Erubi::Engine
         | 
| 46 43 | 
             
                    s.engine "scss", MuchRails::Assets::Sass::Engine, {
         | 
| 47 44 | 
             
                      syntax: "scss",
         | 
| 48 45 | 
             
                      output_style: "compressed",
         | 
| 49 46 | 
             
                    }
         | 
| 50 47 | 
             
                  end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                  # Look for asset files in the app/assets/img folder.
         | 
| 50 | 
            +
                  config.source rails.root.join("app", "assets", "img") do |s|
         | 
| 51 | 
            +
                    s.base_path "img"
         | 
| 52 | 
            +
                  end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                  # Look for asset files in the app/assets/js folder. Support ERB
         | 
| 55 | 
            +
                  # on all .js files.
         | 
| 56 | 
            +
                  config.source rails.root.join("app", "assets", "js") do |s|
         | 
| 57 | 
            +
                    s.base_path "js"
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                    s.engine "js", MuchRails::Assets::Erubi::Engine
         | 
| 60 | 
            +
                  end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                  # Look for asset files in the app/assets/vendor folder
         | 
| 63 | 
            +
                  config.source rails.root.join("app", "assets", "vendor") do |s|
         | 
| 64 | 
            +
                    s.base_path "vendor"
         | 
| 65 | 
            +
                  end
         | 
| 51 66 | 
             
                end
         | 
| 52 67 | 
             
                MuchRails::Assets.init
         | 
| 53 68 | 
             
              end
         | 
    
        data/lib/much-rails/version.rb
    CHANGED
    
    
    
        data/much-rails.gemspec
    CHANGED
    
    | @@ -29,7 +29,7 @@ Gem::Specification.new do |gem| | |
| 29 29 |  | 
| 30 30 | 
             
              gem.add_dependency("activerecord",   ["> 5.0", "< 7.0"])
         | 
| 31 31 | 
             
              gem.add_dependency("activesupport",  ["> 5.0", "< 7.0"])
         | 
| 32 | 
            -
              gem.add_dependency("dassets",        ["~> 0.15. | 
| 32 | 
            +
              gem.add_dependency("dassets",        ["~> 0.15.2"])
         | 
| 33 33 | 
             
              gem.add_dependency("dassets-erubi",  ["~> 0.1.1"])
         | 
| 34 34 | 
             
              gem.add_dependency("dassets-sass",   ["~> 0.5.1"])
         | 
| 35 35 | 
             
              gem.add_dependency("much-boolean",   ["~> 0.2.1"])
         | 
| @@ -37,6 +37,6 @@ Gem::Specification.new do |gem| | |
| 37 37 | 
             
              gem.add_dependency("much-mixin",     ["~> 0.2.4"])
         | 
| 38 38 | 
             
              gem.add_dependency("much-not-given", ["~> 0.1.2"])
         | 
| 39 39 | 
             
              gem.add_dependency("much-result",    ["~> 0.1.3"])
         | 
| 40 | 
            -
              gem.add_dependency("much-slug",      ["~> 0.1. | 
| 40 | 
            +
              gem.add_dependency("much-slug",      ["~> 0.1.2"])
         | 
| 41 41 | 
             
              gem.add_dependency("oj",             ["~> 3.10"])
         | 
| 42 42 | 
             
            end
         | 
| @@ -0,0 +1,45 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require "assert"
         | 
| 4 | 
            +
            require "much-rails/abstract_class"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module MuchRails::AbstractClassTest
         | 
| 7 | 
            +
              class UnitTests < Assert::Context
         | 
| 8 | 
            +
                desc "MuchRails::AbstractClass"
         | 
| 9 | 
            +
                subject{ unit_class }
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                let(:unit_class){ MuchRails::AbstractClass }
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                should "include MuchRails::Mixin" do
         | 
| 14 | 
            +
                  assert_that(subject).includes(MuchRails::Mixin)
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              class ReceiverTests < UnitTests
         | 
| 19 | 
            +
                desc "receiver"
         | 
| 20 | 
            +
                subject{ receiver_class }
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                let(:receiver_class) do
         | 
| 23 | 
            +
                  Class.new.tap{ |c| c.include unit_class }
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
                let(:receiver_subclass) do
         | 
| 26 | 
            +
                  Class.new(receiver_class)
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                should have_accessor :abstract_class
         | 
| 30 | 
            +
                should have_imeths :new, :abstract_class?
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                should "know if it is an abstract class or not" do
         | 
| 33 | 
            +
                  assert_that(subject.abstract_class?).equals(true)
         | 
| 34 | 
            +
                  assert_that(receiver_subclass.abstract_class?).equals(false)
         | 
| 35 | 
            +
                end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                should "prevent calling .new on the receiver" do
         | 
| 38 | 
            +
                  assert_that{ subject.new }.raises(NotImplementedError)
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                should "allow calling .new on subclasses of the receiver" do
         | 
| 42 | 
            +
                  assert_that(receiver_subclass.new).is_a?(subject)
         | 
| 43 | 
            +
                end
         | 
| 44 | 
            +
              end
         | 
| 45 | 
            +
            end
         | 
| @@ -80,13 +80,13 @@ class MuchRails::Action::BaseRouter | |
| 80 80 | 
             
                end
         | 
| 81 81 |  | 
| 82 82 | 
             
                should "build path/URL strings for named URLs" do
         | 
| 83 | 
            -
                  path_string = subject.path_for(:url1,  | 
| 83 | 
            +
                  path_string = subject.path_for(:url1, test: "args")
         | 
| 84 84 | 
             
                  assert_that(path_string).equals("TEST PATH STRING")
         | 
| 85 | 
            -
                  assert_that(@url_set_path_for_call.args).equals([:url1,  | 
| 85 | 
            +
                  assert_that(@url_set_path_for_call.args).equals([:url1, { test: "args" }])
         | 
| 86 86 |  | 
| 87 | 
            -
                  url_string = subject.url_for(:url1,  | 
| 87 | 
            +
                  url_string = subject.url_for(:url1, test: "args")
         | 
| 88 88 | 
             
                  assert_that(url_string).equals("TEST URL STRING")
         | 
| 89 | 
            -
                  assert_that(@url_set_url_for_call.args).equals([:url1,  | 
| 89 | 
            +
                  assert_that(@url_set_url_for_call.args).equals([:url1, { test: "args" }])
         | 
| 90 90 | 
             
                end
         | 
| 91 91 |  | 
| 92 92 | 
             
                should "define request types" do
         | 
| @@ -380,13 +380,13 @@ class MuchRails::Action::BaseRouter | |
| 380 380 |  | 
| 381 381 | 
             
                  subject.add(:url1, Factory.url)
         | 
| 382 382 |  | 
| 383 | 
            -
                  path_string = subject.path_for(:url1,  | 
| 383 | 
            +
                  path_string = subject.path_for(:url1, test: "args")
         | 
| 384 384 | 
             
                  assert_that(path_string).equals("TEST PATH STRING")
         | 
| 385 | 
            -
                  assert_that(@url_path_for_call.args).equals([ | 
| 385 | 
            +
                  assert_that(@url_path_for_call.args).equals([{ test: "args" }])
         | 
| 386 386 |  | 
| 387 | 
            -
                  url_string = subject.url_for(:url1,  | 
| 387 | 
            +
                  url_string = subject.url_for(:url1, test: "args")
         | 
| 388 388 | 
             
                  assert_that(url_string).equals("TEST URL STRING")
         | 
| 389 | 
            -
                  assert_that(@url_url_for_call.args).equals([ | 
| 389 | 
            +
                  assert_that(@url_url_for_call.args).equals([{ test: "args" }])
         | 
| 390 390 | 
             
                end
         | 
| 391 391 | 
             
              end
         | 
| 392 392 |  | 
| @@ -450,8 +450,8 @@ class MuchRails::Action::BaseRouter | |
| 450 450 | 
             
                  assert_that(subject.path)
         | 
| 451 451 | 
             
                    .equals(base_url_class.url_path(router1, url_path1))
         | 
| 452 452 |  | 
| 453 | 
            -
                  assert_that{ subject.path_for( | 
| 454 | 
            -
                  assert_that{ subject.url_for( | 
| 453 | 
            +
                  assert_that{ subject.path_for(test: "args") }.raises(NotImplementedError)
         | 
| 454 | 
            +
                  assert_that{ subject.url_for(test: "args") }.raises(NotImplementedError)
         | 
| 455 455 | 
             
                end
         | 
| 456 456 | 
             
              end
         | 
| 457 457 |  | 
| @@ -206,15 +206,15 @@ class MuchRails::Action::Router | |
| 206 206 | 
             
                should have_imeths :path_for, :url_for
         | 
| 207 207 |  | 
| 208 208 | 
             
                should "know its attributes" do
         | 
| 209 | 
            -
                  path_string = subject.path_for( | 
| 209 | 
            +
                  path_string = subject.path_for(test: "args")
         | 
| 210 210 | 
             
                  assert_that(path_string).equals("TEST PATH OR URL STRING")
         | 
| 211 211 | 
             
                  assert_that(@rails_routes_method_missing_call.args)
         | 
| 212 | 
            -
                    .equals(["#{url_name1}_path".to_sym,  | 
| 212 | 
            +
                    .equals(["#{url_name1}_path".to_sym, { test: "args" }])
         | 
| 213 213 |  | 
| 214 | 
            -
                  url_string = subject.url_for( | 
| 214 | 
            +
                  url_string = subject.url_for(test: "args")
         | 
| 215 215 | 
             
                  assert_that(url_string).equals("TEST PATH OR URL STRING")
         | 
| 216 216 | 
             
                  assert_that(@rails_routes_method_missing_call.args)
         | 
| 217 | 
            -
                    .equals(["#{url_name1}_url".to_sym,  | 
| 217 | 
            +
                    .equals(["#{url_name1}_url".to_sym, { test: "args" }])
         | 
| 218 218 | 
             
                end
         | 
| 219 219 | 
             
              end
         | 
| 220 220 |  | 
    
        data/test/unit/assets_tests.rb
    CHANGED
    
    | @@ -23,7 +23,7 @@ module MuchRails::Assets | |
| 23 23 | 
             
                setup do
         | 
| 24 24 | 
             
                  subject.reset
         | 
| 25 25 |  | 
| 26 | 
            -
                  in_development_env =  | 
| 26 | 
            +
                  in_development_env = true
         | 
| 27 27 | 
             
                  Assert.stub(FakeRails.env, :development?){ in_development_env }
         | 
| 28 28 | 
             
                  Assert.stub(FakeRails.env, :test?){ !in_development_env }
         | 
| 29 29 |  | 
| @@ -34,14 +34,11 @@ module MuchRails::Assets | |
| 34 34 | 
             
                  subject.configure_for_rails(FakeRails)
         | 
| 35 35 | 
             
                end
         | 
| 36 36 |  | 
| 37 | 
            -
                should "configure the fingerprint cache to use  | 
| 37 | 
            +
                should "configure the fingerprint/content cache to use no cache" do
         | 
| 38 38 | 
             
                  assert_that(subject.config.fingerprint_cache)
         | 
| 39 | 
            -
                    .is_instance_of(subject:: | 
| 40 | 
            -
                end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
                should "configure the content cache to use a memory cache" do
         | 
| 39 | 
            +
                    .is_instance_of(subject::NoCache)
         | 
| 43 40 | 
             
                  assert_that(subject.config.content_cache)
         | 
| 44 | 
            -
                    .is_instance_of(subject:: | 
| 41 | 
            +
                    .is_instance_of(subject::NoCache)
         | 
| 45 42 | 
             
                end
         | 
| 46 43 |  | 
| 47 44 | 
             
                should "not configure a file store" do
         | 
| @@ -49,16 +46,14 @@ module MuchRails::Assets | |
| 49 46 | 
             
                    .is_not_equal_to(FakeRails.root.join("public"))
         | 
| 50 47 | 
             
                end
         | 
| 51 48 |  | 
| 52 | 
            -
                should "configure the app's app/assets folder as a source" do
         | 
| 49 | 
            +
                should "configure the app's app/assets/css folder as a source" do
         | 
| 53 50 | 
             
                  source =
         | 
| 54 51 | 
             
                    subject.config.sources.detect do |source|
         | 
| 55 | 
            -
                      source.path == FakeRails.root.join("app", "assets").to_s
         | 
| 52 | 
            +
                      source.path == FakeRails.root.join("app", "assets", "css").to_s
         | 
| 56 53 | 
             
                    end
         | 
| 57 54 |  | 
| 58 55 | 
             
                  assert_that(source).is_not_nil
         | 
| 59 | 
            -
                  assert_that(source. | 
| 60 | 
            -
                  assert_that(source.engines["js"].first)
         | 
| 61 | 
            -
                    .is_instance_of(subject::Erubi::Engine)
         | 
| 56 | 
            +
                  assert_that(source.base_path).equals("css")
         | 
| 62 57 | 
             
                  assert_that(source.engines["scss"].size).equals(2)
         | 
| 63 58 | 
             
                  assert_that(source.engines["scss"].first)
         | 
| 64 59 | 
             
                    .is_instance_of(subject::Erubi::Engine)
         | 
| @@ -66,6 +61,41 @@ module MuchRails::Assets | |
| 66 61 | 
             
                    .is_instance_of(subject::Sass::Engine)
         | 
| 67 62 | 
             
                end
         | 
| 68 63 |  | 
| 64 | 
            +
                should "configure the app's app/assets/img folder as a source" do
         | 
| 65 | 
            +
                  source =
         | 
| 66 | 
            +
                    subject.config.sources.detect do |source|
         | 
| 67 | 
            +
                      source.path == FakeRails.root.join("app", "assets", "img").to_s
         | 
| 68 | 
            +
                    end
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                  assert_that(source).is_not_nil
         | 
| 71 | 
            +
                  assert_that(source.base_path).equals("img")
         | 
| 72 | 
            +
                  assert_that(source.engines.empty?).is_true
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                should "configure the app's app/assets/js folder as a source" do
         | 
| 76 | 
            +
                  source =
         | 
| 77 | 
            +
                    subject.config.sources.detect do |source|
         | 
| 78 | 
            +
                      source.path == FakeRails.root.join("app", "assets", "js").to_s
         | 
| 79 | 
            +
                    end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                  assert_that(source).is_not_nil
         | 
| 82 | 
            +
                  assert_that(source.base_path).equals("js")
         | 
| 83 | 
            +
                  assert_that(source.engines["js"].size).equals(1)
         | 
| 84 | 
            +
                  assert_that(source.engines["js"].first)
         | 
| 85 | 
            +
                    .is_instance_of(subject::Erubi::Engine)
         | 
| 86 | 
            +
                end
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                should "configure the app's app/assets/vendor folder as a source" do
         | 
| 89 | 
            +
                  source =
         | 
| 90 | 
            +
                    subject.config.sources.detect do |source|
         | 
| 91 | 
            +
                      source.path == FakeRails.root.join("app", "assets", "vendor").to_s
         | 
| 92 | 
            +
                    end
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                  assert_that(source).is_not_nil
         | 
| 95 | 
            +
                  assert_that(source.base_path).equals("vendor")
         | 
| 96 | 
            +
                  assert_that(source.engines.empty?).is_true
         | 
| 97 | 
            +
                end
         | 
| 98 | 
            +
             | 
| 69 99 | 
             
                should "initialize itself" do
         | 
| 70 100 | 
             
                  assert_that(@init_call).is_not_nil
         | 
| 71 101 | 
             
                end
         | 
| @@ -84,9 +114,11 @@ module MuchRails::Assets | |
| 84 114 | 
             
                  subject.configure_for_rails(FakeRails)
         | 
| 85 115 | 
             
                end
         | 
| 86 116 |  | 
| 87 | 
            -
                should "configure the content cache to use  | 
| 117 | 
            +
                should "configure the fingerprint/content cache to use a memory cache" do
         | 
| 118 | 
            +
                  assert_that(subject.config.fingerprint_cache)
         | 
| 119 | 
            +
                    .is_instance_of(subject::MemCache)
         | 
| 88 120 | 
             
                  assert_that(subject.config.content_cache)
         | 
| 89 | 
            -
                    .is_instance_of(subject:: | 
| 121 | 
            +
                    .is_instance_of(subject::MemCache)
         | 
| 90 122 | 
             
                end
         | 
| 91 123 |  | 
| 92 124 | 
             
                should "configure a file store for the app's public folder" do
         | 
| @@ -9,12 +9,21 @@ module MuchRails::InputValue | |
| 9 9 | 
             
                subject{ unit_class }
         | 
| 10 10 |  | 
| 11 11 | 
             
                let(:unit_class){ MuchRails::InputValue }
         | 
| 12 | 
            +
                let(:non_blank_but_empty_to_s_object) do
         | 
| 13 | 
            +
                  Class
         | 
| 14 | 
            +
                    .new{
         | 
| 15 | 
            +
                      def to_s
         | 
| 16 | 
            +
                        ["", " "].sample
         | 
| 17 | 
            +
                      end
         | 
| 18 | 
            +
                    }
         | 
| 19 | 
            +
                    .new
         | 
| 20 | 
            +
                end
         | 
| 12 21 |  | 
| 13 22 | 
             
                should have_imeths :strip, :strip_all
         | 
| 14 23 |  | 
| 15 24 | 
             
                should "know its attributes" do
         | 
| 16 25 | 
             
                  # strip
         | 
| 17 | 
            -
                  input_value = [nil, "", " "].sample
         | 
| 26 | 
            +
                  input_value = [nil, "", " ", non_blank_but_empty_to_s_object].sample
         | 
| 18 27 | 
             
                  assert_that(subject.strip(input_value)).is_nil
         | 
| 19 28 |  | 
| 20 29 | 
             
                  input_value = [" VALUE  ", "\r VALUE\n"].sample
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: much-rails
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Kelly Redding
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2021- | 
| 12 | 
            +
            date: 2021-03-26 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: much-style-guide
         | 
| @@ -105,14 +105,14 @@ dependencies: | |
| 105 105 | 
             
                requirements:
         | 
| 106 106 | 
             
                - - "~>"
         | 
| 107 107 | 
             
                  - !ruby/object:Gem::Version
         | 
| 108 | 
            -
                    version: 0.15. | 
| 108 | 
            +
                    version: 0.15.2
         | 
| 109 109 | 
             
              type: :runtime
         | 
| 110 110 | 
             
              prerelease: false
         | 
| 111 111 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 112 112 | 
             
                requirements:
         | 
| 113 113 | 
             
                - - "~>"
         | 
| 114 114 | 
             
                  - !ruby/object:Gem::Version
         | 
| 115 | 
            -
                    version: 0.15. | 
| 115 | 
            +
                    version: 0.15.2
         | 
| 116 116 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 117 117 | 
             
              name: dassets-erubi
         | 
| 118 118 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -217,14 +217,14 @@ dependencies: | |
| 217 217 | 
             
                requirements:
         | 
| 218 218 | 
             
                - - "~>"
         | 
| 219 219 | 
             
                  - !ruby/object:Gem::Version
         | 
| 220 | 
            -
                    version: 0.1. | 
| 220 | 
            +
                    version: 0.1.2
         | 
| 221 221 | 
             
              type: :runtime
         | 
| 222 222 | 
             
              prerelease: false
         | 
| 223 223 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 224 224 | 
             
                requirements:
         | 
| 225 225 | 
             
                - - "~>"
         | 
| 226 226 | 
             
                  - !ruby/object:Gem::Version
         | 
| 227 | 
            -
                    version: 0.1. | 
| 227 | 
            +
                    version: 0.1.2
         | 
| 228 228 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 229 229 | 
             
              name: oj
         | 
| 230 230 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -251,6 +251,7 @@ files: | |
| 251 251 | 
             
            - LICENSE
         | 
| 252 252 | 
             
            - README.md
         | 
| 253 253 | 
             
            - lib/much-rails.rb
         | 
| 254 | 
            +
            - lib/much-rails/abstract_class.rb
         | 
| 254 255 | 
             
            - lib/much-rails/action.rb
         | 
| 255 256 | 
             
            - lib/much-rails/action/base_command_result.rb
         | 
| 256 257 | 
             
            - lib/much-rails/action/base_result.rb
         | 
| @@ -306,6 +307,7 @@ files: | |
| 306 307 | 
             
            - test/support/factory.rb
         | 
| 307 308 | 
             
            - test/support/fake_action_controller.rb
         | 
| 308 309 | 
             
            - test/system/.keep
         | 
| 310 | 
            +
            - test/unit/abstract_class_tests.rb
         | 
| 309 311 | 
             
            - test/unit/action/base_command_result_tests.rb
         | 
| 310 312 | 
             
            - test/unit/action/base_result_tests.rb
         | 
| 311 313 | 
             
            - test/unit/action/base_router_tests.rb
         | 
| @@ -369,8 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 369 371 | 
             
                - !ruby/object:Gem::Version
         | 
| 370 372 | 
             
                  version: '0'
         | 
| 371 373 | 
             
            requirements: []
         | 
| 372 | 
            -
             | 
| 373 | 
            -
            rubygems_version: 2.7.6.2
         | 
| 374 | 
            +
            rubygems_version: 3.2.4
         | 
| 374 375 | 
             
            signing_key: 
         | 
| 375 376 | 
             
            specification_version: 4
         | 
| 376 377 | 
             
            summary: Rails utilities.
         | 
| @@ -381,6 +382,7 @@ test_files: | |
| 381 382 | 
             
            - test/support/factory.rb
         | 
| 382 383 | 
             
            - test/support/fake_action_controller.rb
         | 
| 383 384 | 
             
            - test/system/.keep
         | 
| 385 | 
            +
            - test/unit/abstract_class_tests.rb
         | 
| 384 386 | 
             
            - test/unit/action/base_command_result_tests.rb
         | 
| 385 387 | 
             
            - test/unit/action/base_result_tests.rb
         | 
| 386 388 | 
             
            - test/unit/action/base_router_tests.rb
         |