brut 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61b4016715aa0ca0ab347e21a91bf8e507665e900f20e505fb0100662fa09aa0
4
- data.tar.gz: 7d6934311740a131a9f906d646d00cf3056bb860037cd218ce6c5cd35b84dfb9
3
+ metadata.gz: 37f9d27495d7269447632af6383a1f4e3f24f98bbfcc1838d1a118c09005815f
4
+ data.tar.gz: ef05ae07379e79cef2914b16567b5d57856cb402c152e823ce658b4bc4cb8a69
5
5
  SHA512:
6
- metadata.gz: 89aebab6c15c42835af1b1161d92cc923ba685c89aab1a848c9a8e7dc6c23b7b96691a2ba2fa219611f2440ea3b6860dcfa5d68fb167b1ada35c8a7cd8db3aee
7
- data.tar.gz: fc14225d9512014d5b6e0a07a484407efb07913c86a4c0035adcbc7c4ca8ba477eb7347478e9e31053985fa9d35c4c2f4de097a5f52ff0517ca1b654cee39b67
6
+ metadata.gz: ba995eb4d298f52064d3866eb7712a8cdf62e92e2e1415fb5545a8f8a8e59c3861da28861175c0b83df8b71428a235404b5170e188faab9f1c2ab18d6e3dfc73
7
+ data.tar.gz: 2a4ccedddbc0c8ab977124e40a59f12aaae21e7ba140dd7580a709ae17c8de8b8da49d59db473f8270baf8a34c30e36c96e1d937d6b6ce63bec08a6d88e385a3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brut (0.0.6)
4
+ brut (0.0.7)
5
5
  concurrent-ruby
6
6
  i18n
7
7
  irb
@@ -37,7 +37,7 @@ class Brut::CLI::Apps::DB < Brut::CLI::App
37
37
  seed_data.load_seeds!
38
38
  0
39
39
  rescue Sequel::UniqueConstraintViolation => ex
40
- out.puts "Seed data may have already been loaded: #{ex}"
40
+ raise "Seed data may have already been loaded: #{ex}"
41
41
  end
42
42
  end
43
43
 
@@ -35,10 +35,13 @@ class Brut::FrontEnd::Flash
35
35
 
36
36
  # Set the "notice", which is an informational message. The value is intended to be an I18N key.
37
37
  #
38
- # @param [String] notice the I18n key of the notice. You can use any value you like, but you should decide one way or the other,
39
- # because it will be confusing to use an I18n key sometimes and sometimes a message.
38
+ # @param [String|Array] notice the I18n key of the notice. If this is an array, it will be joined with dots to form an I18n key.
40
39
  def notice=(notice)
41
- self[:notice] = notice
40
+ self[:notice] = if notice
41
+ Array(notice).map(&:to_s).join(".")
42
+ else
43
+ notice
44
+ end
42
45
  end
43
46
  # Access the notice. See {#notice=}
44
47
  def notice = self[:notice]
@@ -48,10 +51,13 @@ class Brut::FrontEnd::Flash
48
51
 
49
52
  # Set the "alert", which is an important error message. The value is intended to be an I18N key.
50
53
  #
51
- # @param [String] alert the I18n key of the notice. You can use any value you like, but you should decide one way or the other,
52
- # because it will be confusing to use an I18n key sometimes and sometimes a message.
54
+ # @param [String|Array] alert the I18n key of the notice. If this is an array, it will be joined with dots to form an I18n eky.
53
55
  def alert=(alert)
54
- self[:alert] = alert
56
+ self[:alert] = if alert
57
+ Array(alert).map(&:to_s).join(".")
58
+ else
59
+ alert
60
+ end
55
61
  end
56
62
  # Access the alert. See {#alert=}
57
63
  def alert = self[:alert]
@@ -18,7 +18,17 @@ RSpec::Matchers.define :have_redirected_to do |page_or_uri,**page_params|
18
18
  if page_or_uri.kind_of?(URI)
19
19
  "Expected #{page_or_uri} but got #{result}"
20
20
  elsif page_or_uri.ancestors.include?(Brut::FrontEnd::Page)
21
- "Expected #{page_or_uri}'s routing (#{page_or_uri.routing(**page_params)}), but got #{result}"
21
+ result_explanation = case result
22
+ when Brut::FrontEnd::Page
23
+ "#{result.page_name} was rendered directly"
24
+ when Brut::FrontEnd::HttpStatus
25
+ "got HTTP status code #{result}"
26
+ when URI
27
+ "got a redirect to #{result} instead"
28
+ else
29
+ "got a #{result.class} instead"
30
+ end
31
+ "Expected redirect to #{page_or_uri}, but #{result_explanation}"
22
32
  else
23
33
  "Unknown error occured or bug with have_redirected_to"
24
34
  end
data/lib/brut/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Brut
2
2
  # @!visibility private
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Bryant Copeland
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-27 00:00:00.000000000 Z
10
+ date: 2025-03-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: irb