great_pretender 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: ded13adb89cf39cbc783b42fec961b8d1918a0e5
4
- data.tar.gz: 5a3842182ee81c1acb8fb1937208a0f40f7ca45e
3
+ metadata.gz: eb62253be2761441bf8ea8afce272f260d2a2bb6
4
+ data.tar.gz: 150374a364f75f88ef4d501e4c8aae17d4314c1c
5
5
  SHA512:
6
- metadata.gz: 492883658952702e1d4edf14d76a148e3c080d293a3ac72aeca6339d397d115d87258693e7f931be9c6f863b6bf43a0ccfa356f95f874fb40d47aa94283949f8
7
- data.tar.gz: 2e77e4ce36db26b0ff71a39ec85f70260e0fb981b57d425fee7949646b61c5753aa3e8e4c65eb6ae1780f62b280cbcda847541dbe3fc5b03fb317bd403a59097
6
+ metadata.gz: 2e93f794863f798c0acd61d114bb702f1324d9986e3e29b71cf7a4f9a49071b9b0b5b3db168d346b4d223042d77ac2bb27cc0ab9a3ba3c40b489b284e41199db
7
+ data.tar.gz: a71df485d09157758175644eea9485ca2ff02e6dd50179dc5771b3bbbf85ddfa9a59fd9d7399193f5338e1f4bd589b55b2af03ffce024c3eb6d17034ab2c88d7
@@ -4,7 +4,7 @@ require "great_pretender/config"
4
4
  module GreatPretender
5
5
  class Mockup
6
6
 
7
- attr_accessor :layout, :slug, :template
7
+ attr_accessor :layout, :path, :slug, :template
8
8
 
9
9
  alias :to_param :slug
10
10
 
@@ -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('/').first
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)
@@ -1,3 +1,3 @@
1
1
  module GreatPretender
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -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(5)
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
- expect(mockup.updated_at).to eq(Time.at(1407427839))
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.3
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-10-29 00:00:00.000000000 Z
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