Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mmontossi committed Aug 1, 2015
1 parent 55a6600 commit 23c60ea
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/crumbs/action_controller/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Base
append_before_action :set_crumbs
end

protected
protected

def set_crumbs
paths = [request.path]
Expand Down
2 changes: 1 addition & 1 deletion lib/crumbs/dsl/namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize(namespace, &block)
end

def controller(name, &block)
Controller.new("#{@namsepace}/#{name}", &block)
Controller.new("#{@namespace}/#{name}", &block)
end

end
Expand Down
2 changes: 1 addition & 1 deletion lib/crumbs/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Crumbs

VERSION = '2.1.0'
VERSION = '2.1.1'

end
2 changes: 1 addition & 1 deletion test/dummy/app/controllers/namespace/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Namespace::PagesController < ApplicationController

def index
render :crumbs
render template: 'pages/crumbs'
end

end
Expand Down
19 changes: 19 additions & 0 deletions test/with_last_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ class WithLastTest < ActionDispatch::IntegrationTest
Crumbs.config.show_last = true
end

test 'namespaced controller' do
get '/namespaced'
assert_equal(
[
{ base_url: 'http://www.example.com', path: '/namespaced', fullpath: '/namespaced' }
],
session[:referers]
)
if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
assert_select 'a', 2
assert_select 'a[href="/"]:contains("Home")'
assert_select 'a[href="/namespaced"]:contains("Namespaced Home")'
else
assert_select 'a', count: 2
assert_select 'a[href="/"]', 'Home'
assert_select 'a[href="/namespaced"]', 'Namespaced Home'
end
end

test 'last request in same path' do
get '/'
assert_equal(
Expand Down
17 changes: 17 additions & 0 deletions test/without_last_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ class WithoutLastTest < ActionDispatch::IntegrationTest
Crumbs.config.show_last = false
end

test 'namespaced controller' do
get '/namespaced'
assert_equal(
[
{ base_url: 'http://www.example.com', path: '/namespaced', fullpath: '/namespaced' }
],
session[:referers]
)
if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
assert_select 'a', 1
assert_select 'a[href="/"]:contains("Home")'
else
assert_select 'a', count: 2
assert_select 'a[href="/"]', 'Home'
end
end

test 'last request in same path' do
get '/'
assert_equal(
Expand Down

0 comments on commit 23c60ea

Please sign in to comment.