loaf 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.
- data/CHANGELOG.md +6 -1
- data/Gemfile.lock +1 -1
- data/lib/loaf/controller_extensions.rb +2 -4
- data/lib/loaf/version.rb +1 -1
- data/lib/loaf/view_extensions.rb +1 -1
- data/spec/integration/crumbs_routing_spec.rb +11 -1
- data/spec/loaf/controller_extensions_spec.rb +53 -0
- data/spec/rails_app/app/views/posts/index.html.erb +2 -0
- metadata +16 -14
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
0.2.
|
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
@@ -32,9 +32,7 @@ module Loaf
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
|
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
|
65
|
+
def clear_breadcrumbs
|
68
66
|
_breadcrumbs.clear
|
69
67
|
end
|
70
68
|
|
data/lib/loaf/version.rb
CHANGED
data/lib/loaf/view_extensions.rb
CHANGED
@@ -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
|
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.
|
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-
|
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: &
|
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: *
|
24
|
+
version_requirements: *2152603000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rails
|
27
|
-
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: *
|
35
|
+
version_requirements: *2152602060
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sqlite3
|
38
|
-
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: *
|
46
|
+
version_requirements: *2152600360
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec-rails
|
49
|
-
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: *
|
57
|
+
version_requirements: *2152598720
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: capybara
|
60
|
-
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: *
|
68
|
+
version_requirements: *2152595720
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
|
-
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: *
|
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
|