showcase-rails 0.2.0 → 0.2.1
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/README.md +4 -11
- data/app/models/showcase/path.rb +7 -2
- data/lib/showcase/engine.rb +6 -2
- data/lib/showcase/integration_test.rb +9 -2
- data/lib/showcase/version.rb +1 -1
- data/lib/showcase.rb +4 -4
- 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: a546309faa4499b63781df854aa283c3d3a382f91f0c9be8e00a37a5dcbd0b04
|
4
|
+
data.tar.gz: 1a7b269de49a2015c7ad9bc037de1e68aed4b33217771322f8345e859bdc5bc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2779fe6f14b9a07db6a161dc4915a90aa2c1419f19dede0822d8009730b06a3b3006ec0eabcf8d008000d48a4997bdd4342b49dd59b35d4dfb205b520493ffcd
|
7
|
+
data.tar.gz: f1bd8f9effd8ee3af53ab9bddf3456c3bff072e4cfb75d4e6b110a0925f35d996b2dce12f6adeb9e236ae5d5aa8f93eb3c93900b2d53f17c0930b44117b5e043
|
data/README.md
CHANGED
@@ -31,9 +31,9 @@ Which will then render the following:
|
|
31
31
|
|
32
32
|
## Automatic smokescreen testing
|
33
33
|
|
34
|
-
|
34
|
+
Showcase automatically runs integration tests for all your Showcases by rendering them and asserting they respond with `200 OK`. As long as `gem "showcase-rails"` is in the `:test` group you're set.
|
35
35
|
|
36
|
-
|
36
|
+
If you want to tweak this, run `bin/rails showcase:install:integration_test` and open `test/integration/showcase_test.rb`. You can then add your own `setup` and `teardown` hooks, as well as override the provided `assert_showcase_preview` to add custom assertions.
|
37
37
|
|
38
38
|
## View examples
|
39
39
|
|
@@ -86,16 +86,9 @@ partials, make sure to include `"showcase"` in your list of assets.
|
|
86
86
|
|
87
87
|
## Installation
|
88
88
|
|
89
|
-
Add this line to your application's Gemfile.
|
90
|
-
[Showcase::IntegrationTest](lib/showcase/integration_test.rb) class, make sure
|
91
|
-
that the `showcase-rails` gems is available to your test environment:
|
92
|
-
|
89
|
+
Add this line to your application's Gemfile. To get the automatic integration testing make sure the `showcase-rails` gem is available to your test environment:
|
93
90
|
|
94
91
|
```ruby
|
95
|
-
# nested in the default group
|
96
|
-
gem "showcase-rails"
|
97
|
-
|
98
|
-
# or nested in the :development and :test groups
|
99
92
|
group :development, :test do
|
100
93
|
gem "showcase-rails"
|
101
94
|
end
|
@@ -108,7 +101,7 @@ $ bundle
|
|
108
101
|
|
109
102
|
Or install it yourself as:
|
110
103
|
```bash
|
111
|
-
$ gem install showcase
|
104
|
+
$ gem install showcase-rails
|
112
105
|
```
|
113
106
|
|
114
107
|
## Contributing
|
data/app/models/showcase/path.rb
CHANGED
@@ -41,8 +41,13 @@ class Showcase::Path
|
|
41
41
|
|
42
42
|
private
|
43
43
|
|
44
|
-
def find(id)
|
45
|
-
|
44
|
+
def find(id)
|
45
|
+
children.find { _1.id == id }
|
46
|
+
end
|
47
|
+
|
48
|
+
def insert(id)
|
49
|
+
self.class.new(id).tap { self << _1 }
|
50
|
+
end
|
46
51
|
end
|
47
52
|
|
48
53
|
def self.tree
|
data/lib/showcase/engine.rb
CHANGED
@@ -2,8 +2,12 @@ module Showcase
|
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
isolate_namespace Showcase
|
4
4
|
|
5
|
-
initializer "showcase.assets" do
|
6
|
-
|
5
|
+
initializer "showcase.assets" do
|
6
|
+
config.assets.precompile += %w[showcase_manifest]
|
7
|
+
end
|
8
|
+
|
9
|
+
initializer "showcase.integration_test.autorun" do
|
10
|
+
Showcase::IntegrationTest.autorun if Rails.env.test?
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
@@ -1,10 +1,17 @@
|
|
1
1
|
class Showcase::IntegrationTest < ActionDispatch::IntegrationTest
|
2
2
|
def self.inherited(test_class)
|
3
3
|
super
|
4
|
+
test_class.prepare
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.autorun
|
8
|
+
at_exit { prepare unless subclasses.any? }
|
9
|
+
end
|
4
10
|
|
11
|
+
def self.prepare
|
5
12
|
tree = Showcase::Path.tree
|
6
13
|
tree.flat_map(&:ordered_paths).each do |path|
|
7
|
-
|
14
|
+
test "Showcase: GET showcase/previews/#{path.id} renders successfully" do
|
8
15
|
get showcase.preview_path(path.id)
|
9
16
|
|
10
17
|
assert_response :ok
|
@@ -12,7 +19,7 @@ class Showcase::IntegrationTest < ActionDispatch::IntegrationTest
|
|
12
19
|
end
|
13
20
|
end
|
14
21
|
|
15
|
-
|
22
|
+
test "Showcase: isn't empty" do
|
16
23
|
assert_not_empty tree, "Showcase couldn't find any samples to generate tests for"
|
17
24
|
end
|
18
25
|
end
|
data/lib/showcase/version.rb
CHANGED
data/lib/showcase.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
|
-
loader = Zeitwerk::Loader.for_gem
|
3
|
-
loader.ignore("#{__dir__}/showcase-rails.rb")
|
4
|
-
loader.setup
|
1
|
+
require_relative "showcase/version"
|
5
2
|
|
6
3
|
module Showcase
|
4
|
+
autoload :IntegrationTest, "showcase/integration_test"
|
5
|
+
autoload :RouteHelper, "showcase/route_helper"
|
6
|
+
|
7
7
|
singleton_class.attr_accessor :sample_renderer
|
8
8
|
@sample_renderer = ->(lines) { tag.pre lines.join.strip_heredoc }
|
9
9
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: showcase-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Pence
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-02-
|
12
|
+
date: 2023-02-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|