great_pretender 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/great_pretender/mockup.rb +1 -1
- data/lib/great_pretender/mockup_locator.rb +4 -1
- data/lib/great_pretender/version.rb +1 -1
- data/spec/fixtures/view_path_a/layouts/admin/base.html.slim +0 -0
- data/spec/fixtures/view_path_b/mockups/admin/base/nested_layout.html.slim +0 -0
- data/spec/lib/great_pretender/mockup_locator_spec.rb +6 -1
- data/spec/lib/great_pretender/mockup_spec.rb +2 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb62253be2761441bf8ea8afce272f260d2a2bb6
|
4
|
+
data.tar.gz: 150374a364f75f88ef4d501e4c8aae17d4314c1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e93f794863f798c0acd61d114bb702f1324d9986e3e29b71cf7a4f9a49071b9b0b5b3db168d346b4d223042d77ac2bb27cc0ab9a3ba3c40b489b284e41199db
|
7
|
+
data.tar.gz: a71df485d09157758175644eea9485ca2ff02e6dd50179dc5771b3bbbf85ddfa9a59fd9d7399193f5338e1f4bd589b55b2af03ffce024c3eb6d17034ab2c88d7
|
@@ -49,7 +49,9 @@ module GreatPretender
|
|
49
49
|
# Mockups can have a layout by being in a folder named after that
|
50
50
|
# layout; for example, "app/views/mockups/admin/index" will look for an
|
51
51
|
# "admin" template
|
52
|
-
layout = slug.split('/')
|
52
|
+
layout = slug.split('/')
|
53
|
+
layout.pop
|
54
|
+
layout = layout.join('/')
|
53
55
|
if layout && layout.length > 0
|
54
56
|
@view_paths.each do |view_path|
|
55
57
|
layout_path = view_path.join('layouts')
|
@@ -63,6 +65,7 @@ module GreatPretender
|
|
63
65
|
|
64
66
|
def mockup_for(view_path, root, path)
|
65
67
|
mockup = Mockup.new(path)
|
68
|
+
mockup.path = path
|
66
69
|
mockup.slug = slug_for(root, path)
|
67
70
|
mockup.layout = layout_for(mockup.slug)
|
68
71
|
mockup.template = template_for(view_path, root, mockup.slug)
|
File without changes
|
File without changes
|
@@ -19,10 +19,11 @@ describe GreatPretender::MockupLocator do
|
|
19
19
|
let(:regular_mockup) { mockup_locator.mockups.find {|m| m.slug =~ /^processed/ } }
|
20
20
|
let(:partial_mockup) { mockup_locator.mockups.find {|m| m.slug =~ /^_/ } }
|
21
21
|
let(:admin_mockup) { mockup_locator.mockups.find {|m| m.slug =~ /admin/ } }
|
22
|
+
let(:nested_admin_mockup) { mockup_locator.mockups.find {|m| m.slug =~ /admin\/base/ } }
|
22
23
|
|
23
24
|
context "::mockups" do
|
24
25
|
it "returns all mockups in the pre-configured mockup directories" do
|
25
|
-
expect(mockup_locator.mockups.size).to eq(
|
26
|
+
expect(mockup_locator.mockups.size).to eq(6)
|
26
27
|
end
|
27
28
|
|
28
29
|
it "returns mockups with Rails-friendly template names" do
|
@@ -40,6 +41,10 @@ describe GreatPretender::MockupLocator do
|
|
40
41
|
it "returns detected layouts for well-named mockups" do
|
41
42
|
expect(admin_mockup.layout).to eq("admin")
|
42
43
|
end
|
44
|
+
|
45
|
+
it "returns layouts in sub-folders, too" do
|
46
|
+
expect(nested_admin_mockup.layout).to eq("admin/base")
|
47
|
+
end
|
43
48
|
end
|
44
49
|
|
45
50
|
context "::find" do
|
@@ -28,7 +28,8 @@ describe GreatPretender::Mockup do
|
|
28
28
|
|
29
29
|
context ".updated_at" do
|
30
30
|
it "returns the template file's mtime for its slug" do
|
31
|
-
|
31
|
+
`touch #{mockup.path}`
|
32
|
+
expect(mockup.updated_at.to_i).to eq(Time.now.to_i)
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: great_pretender
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flip Sasser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,10 +70,12 @@ files:
|
|
70
70
|
- spec/controllers/great_pretender/mockups_controller_spec.rb
|
71
71
|
- spec/fixtures/view_path_a/.DS_Store
|
72
72
|
- spec/fixtures/view_path_a/layouts/admin.html.slim
|
73
|
+
- spec/fixtures/view_path_a/layouts/admin/base.html.slim
|
73
74
|
- spec/fixtures/view_path_a/mockups/_partial.haml
|
74
75
|
- spec/fixtures/view_path_a/mockups/no_processed.slim
|
75
76
|
- spec/fixtures/view_path_a/mockups/processed.html.erb
|
76
77
|
- spec/fixtures/view_path_b/mockups/_partial.html.haml
|
78
|
+
- spec/fixtures/view_path_b/mockups/admin/base/nested_layout.html.slim
|
77
79
|
- spec/fixtures/view_path_b/mockups/admin/index.html.erb
|
78
80
|
- spec/lib/great_pretender/config_spec.rb
|
79
81
|
- spec/lib/great_pretender/mockup_locator_spec.rb
|
@@ -110,10 +112,12 @@ test_files:
|
|
110
112
|
- spec/controllers/great_pretender/mockups_controller_spec.rb
|
111
113
|
- spec/fixtures/view_path_a/.DS_Store
|
112
114
|
- spec/fixtures/view_path_a/layouts/admin.html.slim
|
115
|
+
- spec/fixtures/view_path_a/layouts/admin/base.html.slim
|
113
116
|
- spec/fixtures/view_path_a/mockups/_partial.haml
|
114
117
|
- spec/fixtures/view_path_a/mockups/no_processed.slim
|
115
118
|
- spec/fixtures/view_path_a/mockups/processed.html.erb
|
116
119
|
- spec/fixtures/view_path_b/mockups/_partial.html.haml
|
120
|
+
- spec/fixtures/view_path_b/mockups/admin/base/nested_layout.html.slim
|
117
121
|
- spec/fixtures/view_path_b/mockups/admin/index.html.erb
|
118
122
|
- spec/lib/great_pretender/config_spec.rb
|
119
123
|
- spec/lib/great_pretender/mockup_locator_spec.rb
|