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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/brut/cli/apps/db.rb +1 -1
- data/lib/brut/front_end/flash.rb +12 -6
- data/lib/brut/spec_support/matchers/have_redirected_to.rb +11 -1
- data/lib/brut/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37f9d27495d7269447632af6383a1f4e3f24f98bbfcc1838d1a118c09005815f
|
4
|
+
data.tar.gz: ef05ae07379e79cef2914b16567b5d57856cb402c152e823ce658b4bc4cb8a69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba995eb4d298f52064d3866eb7712a8cdf62e92e2e1415fb5545a8f8a8e59c3861da28861175c0b83df8b71428a235404b5170e188faab9f1c2ab18d6e3dfc73
|
7
|
+
data.tar.gz: 2a4ccedddbc0c8ab977124e40a59f12aaae21e7ba140dd7580a709ae17c8de8b8da49d59db473f8270baf8a34c30e36c96e1d937d6b6ce63bec08a6d88e385a3
|
data/Gemfile.lock
CHANGED
data/lib/brut/cli/apps/db.rb
CHANGED
data/lib/brut/front_end/flash.rb
CHANGED
@@ -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.
|
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.
|
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
|
-
|
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
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.
|
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
|
10
|
+
date: 2025-03-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: irb
|