loaf 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
- 0.2.0 (February , 2012)
1
+ 0.2.1 (February 22, 2012)
2
+
3
+ * Add more integration tests and fixed bug with adding breadcrumbs inside view
4
+ * Add specs for controller extensions
5
+
6
+ 0.2.0 (February 18, 2012)
2
7
 
3
8
  * Change gemspec with new gem dependencies, use git
4
9
  * Setup testing environment with dummy rails app
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- loaf (0.1.1)
4
+ loaf (0.2.0)
5
5
  rails
6
6
 
7
7
  GEM
@@ -32,9 +32,7 @@ module Loaf
32
32
  end
33
33
  end
34
34
 
35
- def _process_url(url)
36
- end
37
- end
35
+ end # ClassMethods
38
36
 
39
37
  module InstanceMethods
40
38
 
@@ -64,7 +62,7 @@ module Loaf
64
62
  @_breadcrumbs ||= []
65
63
  end
66
64
 
67
- def clear_crumbs
65
+ def clear_breadcrumbs
68
66
  _breadcrumbs.clear
69
67
  end
70
68
 
data/lib/loaf/version.rb CHANGED
@@ -4,7 +4,7 @@ module Loaf
4
4
  module Version
5
5
  MAJOR = 0
6
6
  MINOR = 2
7
- PATCH = 0
7
+ PATCH = 1
8
8
  BUILD = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.');
@@ -9,7 +9,7 @@ module Loaf
9
9
  # Adds breadcrumbs in a view.
10
10
  #
11
11
  def add_breadcrumb(name, url)
12
- _breadcrumbs.push(name, url)
12
+ _breadcrumbs.push Loaf::Crumb.new(name, url)
13
13
  end
14
14
 
15
15
  # Renders breadcrumbs inside view.
@@ -22,7 +22,7 @@ describe "crumbs routing" do
22
22
  end
23
23
  end
24
24
 
25
- it 'should' do
25
+ it 'should inherit and add new action specific breadcrumb' do
26
26
  visit new_post_path
27
27
  within '#breadcrumbs' do
28
28
  page.should have_content 'All Posts'
@@ -30,4 +30,14 @@ describe "crumbs routing" do
30
30
  end
31
31
  end
32
32
  end
33
+
34
+ context 'adding breadcrumbs within view' do
35
+ it 'should append view specified breadcrumb' do
36
+ visit posts_path
37
+ within '#breadcrumbs' do
38
+ page.should have_content 'All Posts'
39
+ page.should have_content 'View Post'
40
+ end
41
+ end
42
+ end
33
43
  end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe Loaf::ControllerExtensions do
4
+
5
+ class Controller
6
+ def self.helper_method(*args); end
7
+ include Loaf::ControllerExtensions
8
+ end
9
+
10
+ let(:name) { stub }
11
+ let(:url) { stub }
12
+ let(:options) { stub }
13
+
14
+ context 'classes extending controller_extensions' do
15
+ subject { Controller }
16
+ specify { should respond_to(:add_breadcrumb) }
17
+ specify { subject.new.should respond_to(:add_breadcrumb) }
18
+ specify { subject.new.should respond_to(:add_breadcrumbs) }
19
+ specify { subject.new.should respond_to(:clear_breadcrumbs) }
20
+ end
21
+
22
+ context 'class methods' do
23
+ let(:controller) { Controller }
24
+ let(:instance) { Class.new(Controller) }
25
+
26
+ it 'invokes before_filter' do
27
+ controller.should_receive(:before_filter)
28
+ controller.add_breadcrumb('name', 'url_path')
29
+ end
30
+
31
+ it 'delegates to instance' do
32
+ controller.stub(:before_filter).and_yield instance
33
+ instance.should_receive(:send).with(:add_breadcrumb, name, url, options)
34
+ controller.add_breadcrumb(name, url, options)
35
+ end
36
+ end
37
+
38
+ context 'instance methods' do
39
+ let(:controller) { Controller }
40
+ let(:instance) { Controller.new }
41
+
42
+ it 'instantiates breadcrumbs container' do
43
+ Loaf::Crumb.should_receive(:new).with(name, url)
44
+ instance.add_breadcrumb(name,url)
45
+ end
46
+
47
+ it 'adds breadcrumb to collection' do
48
+ expect do
49
+ instance.add_breadcrumb(name, url)
50
+ end.to change { instance._breadcrumbs.size }.by(1)
51
+ end
52
+ end
53
+ end # Loaf::ControllerExtensions
@@ -1 +1,3 @@
1
+ <% add_breadcrumb 'View Post', :posts_path %>
2
+
1
3
  <h1>Posts:index</h1>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-18 00:00:00.000000000 Z
12
+ date: 2012-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2152648740 !ruby/object:Gem::Requirement
16
+ requirement: &2152603000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2152648740
24
+ version_requirements: *2152603000
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rails
27
- requirement: &2152647200 !ruby/object:Gem::Requirement
27
+ requirement: &2152602060 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.1'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2152647200
35
+ version_requirements: *2152602060
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sqlite3
38
- requirement: &2152646320 !ruby/object:Gem::Requirement
38
+ requirement: &2152600360 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2152646320
46
+ version_requirements: *2152600360
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec-rails
49
- requirement: &2152644360 !ruby/object:Gem::Requirement
49
+ requirement: &2152598720 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2152644360
57
+ version_requirements: *2152598720
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: capybara
60
- requirement: &2152642680 !ruby/object:Gem::Requirement
60
+ requirement: &2152595720 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2152642680
68
+ version_requirements: *2152595720
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &2152641740 !ruby/object:Gem::Requirement
71
+ requirement: &2152594960 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2152641740
79
+ version_requirements: *2152594960
80
80
  description: Loaf helps you manage breadcrumbs in your rails app. It aims to handle
81
81
  crumb data through easy dsl and expose it through view helpers without any assumptions
82
82
  about markup.
@@ -112,6 +112,7 @@ files:
112
112
  - spec/integration/configuration_spec.rb
113
113
  - spec/integration/crumbs_routing_spec.rb
114
114
  - spec/integration/nested_crumbs_spec.rb
115
+ - spec/loaf/controller_extensions_spec.rb
115
116
  - spec/loaf/crumb_formatter_spec.rb
116
117
  - spec/loaf/translation_spec.rb
117
118
  - spec/loaf_spec.rb
@@ -188,6 +189,7 @@ test_files:
188
189
  - spec/integration/configuration_spec.rb
189
190
  - spec/integration/crumbs_routing_spec.rb
190
191
  - spec/integration/nested_crumbs_spec.rb
192
+ - spec/loaf/controller_extensions_spec.rb
191
193
  - spec/loaf/crumb_formatter_spec.rb
192
194
  - spec/loaf/translation_spec.rb
193
195
  - spec/loaf_spec.rb