dry_views 0.0.1 → 0.0.2

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.
data/CHANGELOG CHANGED
@@ -1,2 +1,8 @@
1
+ Version 0.0.2 - AUG.14.2012
2
+ - Fixes Typos
3
+ - Tighten gem dependencies
4
+ - Added badges for Travis-CI & CodeClimate
5
+ - More specs
6
+
1
7
  Version 0.0.1 - AUG.14.2012
2
8
  - Initial Release
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
- # DryViews
1
+ # DryViews [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/pboling/dry_views) [![Build Status](https://secure.travis-ci.org/pboling/dry_views.png?branch=master)](http://travis-ci.org/pboling/dry_views)
2
2
 
3
- Keep the views dry with content_for_with_default and friends!
3
+ ## Why?
4
+
5
+ * Keep the views dry with content_for_with_default and friends!
6
+ * Complete flexibility in defining defaults and overrides.
7
+ * Remove most or all logic from views.
8
+ * Allow for no content to override a default.
4
9
 
5
10
  DryViews provides extensions to ActionView::Helpers::CaptureHelper, which is part of ActionPack:
6
11
  * content_for_with_default
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  # Development Dependencies
19
19
  gem.add_development_dependency(%q<rails>, ["> 3"])
20
20
  gem.add_development_dependency(%q<activesupport>, ["> 3"])
21
- gem.add_development_dependency(%q<rspec-rails>, [">= 2.8.0"])
21
+ gem.add_development_dependency(%q<rspec-rails>, [">= 2.11.0"])
22
22
  gem.add_development_dependency(%q<reek>, [">= 1.2.8"])
23
23
  gem.add_development_dependency(%q<roodi>, [">= 2.1.0"])
24
24
 
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2008-12 Peter H. Boling of 9thBit LLC
2
2
  # Released under the MIT license
3
3
  # For Rails 3+
4
- module SanitizeEmail
4
+ module DryViews
5
5
  class Railtie < ::Rails::Railtie
6
6
 
7
7
  config.before_configuration do
@@ -1,3 +1,3 @@
1
1
  module DryViews
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -4,21 +4,61 @@ describe DummyController do
4
4
 
5
5
  render_views
6
6
 
7
- before(:each) do
8
- get :index
9
- end
7
+ describe "content_for" do
8
+ before(:each) do
9
+ get :content_for
10
+ end
10
11
 
11
- describe "CaptureHelper" do
12
12
  it "should be success" do
13
13
  response.should be_success
14
14
  end
15
15
  it "should render :main_content override" do
16
16
  response.body.should =~ /This is main_content override/m
17
17
  end
18
+ it "should render :top_content override" do
19
+ response.body.should =~ /This is top_content override/m
20
+ end
21
+ end
22
+
23
+ describe "content_for_with_default" do
24
+ before(:each) do
25
+ get :content_for_with_default
26
+ end
27
+
28
+ it "should be success" do
29
+ response.should be_success
30
+ end
31
+ it "should render action template in body" do
32
+ response.body.should =~ /This is just an action template/m
33
+ end
34
+ it "should render :main_content default" do
35
+ response.body.should =~ /This is default main_content/m
36
+ end
18
37
  it "should render :top_content default" do
19
38
  response.body.should =~ /This is default top_content/m
20
39
  end
40
+ end
41
+
42
+ describe "no_content_for" do
43
+ before(:each) do
44
+ get :no_content
45
+ end
21
46
 
47
+ it "should be success" do
48
+ response.should be_success
49
+ end
50
+ it "should not render :main_content default" do
51
+ response.body.should_not =~ /This is main_content override/m
52
+ end
53
+ it "should not render :main_content override" do
54
+ response.body.should_not =~ /This is default main_content/m
55
+ end
56
+ it "should not render :top_content default" do
57
+ response.body.should_not =~ /This is top_content override/m
58
+ end
59
+ it "should not render :top_content override" do
60
+ response.body.should_not =~ /This is default top_content/m
61
+ end
22
62
  end
23
63
 
24
64
  end
@@ -1,6 +1,12 @@
1
1
  class DummyController < ApplicationController
2
2
 
3
- def index
3
+ def content_for
4
+ end
5
+
6
+ def content_for_with_default
7
+ end
8
+
9
+ def no_content
4
10
  end
5
11
 
6
12
  end
@@ -0,0 +1 @@
1
+ <%- no_content_for :main_content %>
@@ -1,3 +1,9 @@
1
+ <%= content_for :top_content do %>
2
+ <p>
3
+ This is top_content override.
4
+ </p>
5
+ <% end %>
6
+
1
7
  <%= content_for :main_content do %>
2
8
  <p>
3
9
  This is main_content override.
@@ -0,0 +1,4 @@
1
+
2
+ <p>
3
+ This is just an action template.
4
+ </p>
@@ -0,0 +1,9 @@
1
+ <%- no_content_for :top_content %>
2
+
3
+ <%= render :partial => 'no_main_content' %>
4
+
5
+ <%= content_for :main_content do %>
6
+ <p>
7
+ This is main_content override.
8
+ </p>
9
+ <% end %>
@@ -20,5 +20,7 @@
20
20
 
21
21
  <% end %>
22
22
 
23
+ <%= yield %>
24
+
23
25
  </body>
24
26
  </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry_views
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: 2.8.0
53
+ version: 2.11.0
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: 2.8.0
61
+ version: 2.11.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: reek
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -123,7 +123,10 @@ files:
123
123
  - spec/dummy/app/helpers/application_helper.rb
124
124
  - spec/dummy/app/mailers/.gitkeep
125
125
  - spec/dummy/app/models/.gitkeep
126
- - spec/dummy/app/views/dummy/index.html.erb
126
+ - spec/dummy/app/views/dummy/_no_main_content.html.erb
127
+ - spec/dummy/app/views/dummy/content_for.html.erb
128
+ - spec/dummy/app/views/dummy/content_for_with_default.html.erb
129
+ - spec/dummy/app/views/dummy/no_content.html.erb
127
130
  - spec/dummy/app/views/layouts/application.html.erb
128
131
  - spec/dummy/config.ru
129
132
  - spec/dummy/config/application.rb
@@ -186,7 +189,10 @@ test_files:
186
189
  - spec/dummy/app/helpers/application_helper.rb
187
190
  - spec/dummy/app/mailers/.gitkeep
188
191
  - spec/dummy/app/models/.gitkeep
189
- - spec/dummy/app/views/dummy/index.html.erb
192
+ - spec/dummy/app/views/dummy/_no_main_content.html.erb
193
+ - spec/dummy/app/views/dummy/content_for.html.erb
194
+ - spec/dummy/app/views/dummy/content_for_with_default.html.erb
195
+ - spec/dummy/app/views/dummy/no_content.html.erb
190
196
  - spec/dummy/app/views/layouts/application.html.erb
191
197
  - spec/dummy/config.ru
192
198
  - spec/dummy/config/application.rb