navigasmic 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -4,7 +4,7 @@ structures in Rails.
4
4
  Documentation and other useful information can be found at
5
5
  https://github.com/jejacks0n/navigasmic
6
6
 
7
- Copyright (c) 2011 Jeremy Jackson
7
+ Copyright (c) 2012 Jeremy Jackson
8
8
 
9
9
  Permission is hereby granted, free of charge, to any person obtaining
10
10
  a copy of this software and associated documentation files (the
@@ -2,17 +2,14 @@ Navigasmic.setup do |config|
2
2
 
3
3
  # Defining Navigation Structures:
4
4
  #
5
- # You can begin by defining your navigation structures here. You can also define them directly in the view if you'd
6
- # like, but it's recommended to eventually move them here to clean help up your views. You can read about Navigasmic
7
- # at https://github.com/jejacks0n/navigasmic
5
+ # You can define your navigation structures and configure the builders in this initializer.
8
6
  #
9
- # When you're defining navigation here, it's basically the same as if you were doing it in the view but the scope is
10
- # different. It's important to understand that -- and use procs where you want things to execute in the view scope.
7
+ # When defining navigation here, it's important to understand that the scope is not the same as the view scope -- and
8
+ # you should use procs where you want things to execute in the view scope.
11
9
  #
12
10
  # Once you've defined some navigation structures and configured your builders you can render navigation in your views
13
11
  # using the `semantic_navigation` view helper. You can also use the same syntax to define your navigation structures
14
- # in your views, and eventually move them here (it's handy to prototype navigation/css by putting them in the views
15
- # first).
12
+ # in your views -- and eventually move them here if you want.
16
13
  #
17
14
  # <%= semantic_navigation :primary %>
18
15
  #
@@ -21,7 +18,7 @@ Navigasmic.setup do |config|
21
18
  # <%= semantic_navigation :primary, config: :blockquote %>
22
19
  # <%= semantic_navigation :primary, builder: Navigasmic::Builder::MapBuilder %>
23
20
  #
24
- # When defining navigation in your views just pass it a block (the same as here basically).
21
+ # When defining navigation in your views just pass it a block.
25
22
  #
26
23
  # <%= semantic_navigation :primary do |n| %>
27
24
  # <% n.item 'About Me' %>
@@ -34,9 +31,9 @@ Navigasmic.setup do |config|
34
31
 
35
32
  # Groups and Items:
36
33
  #
37
- # You can create a structure using `group`, and `item`. You can nest items inside groups or items. In the
38
- # following example, the "Articles" item will always highlight on the blog/posts controller, and the nested article
39
- # items will only highlight when on those specific pages. The "Links" item will be disabled unless the user is
34
+ # Create navigation structures using the `group`, and `item` methods. You can nest items inside groups or items.
35
+ # In the following example, the "Articles" item will always highlight on the blog/posts controller, and the nested
36
+ # article items will only highlight on those specific pages. The "Links" item will be disabled unless the user is
40
37
  # logged in.
41
38
  #
42
39
  #n.group 'Blog' do
@@ -47,11 +44,11 @@ Navigasmic.setup do |config|
47
44
  # n.item 'Links', controller: '/blog/links', disabled_if: proc{ !logged_in? }
48
45
  #end
49
46
  #
50
- # You can hide specific specific items or groups. Here we specify that the "About" section of navigation should
47
+ # You can hide specific specific items or groups, and here we specify that the "Admin" section of navigation should
51
48
  # only be displayed if the user is logged in.
52
49
  #
53
- #n.group 'About', hidden_unless: proc{ logged_in? } do
54
- # n.item 'About Me', class: 'featured', link_html: {class: 'about-me'}
50
+ #n.group 'Admin', hidden_unless: proc{ logged_in? } do
51
+ # n.item 'Manage Posts', class: 'posts', link_html: {data: {tools: 'posts'}}
55
52
  #end
56
53
  #
57
54
  # Scoping:
@@ -92,9 +89,9 @@ Navigasmic.setup do |config|
92
89
 
93
90
  # Naming Builder Configurations:
94
91
  #
95
- # If you want to define a named configuration for a builder, just provide a hash with the name, and the builder to
92
+ # If you want to define a named configuration for a builder, just provide a hash with the name and the builder to
96
93
  # configure. The named configurations can then be used during rendering by specifying a `:config => :bootstrap`
97
- # option to the `semantic_navigation` view helper.
94
+ # option.
98
95
  #
99
96
  # A Twitter Bootstrap configuration:
100
97
  #
@@ -103,6 +100,7 @@ Navigasmic.setup do |config|
103
100
  # <%= semantic_navigation :primary, config: :bootstrap, class: 'nav-pills' %>
104
101
  #
105
102
  # Or to create a full navigation bar using twitter bootstrap you could use the following in your view:
103
+ #
106
104
  # <div class="navbar">
107
105
  # <div class="navbar-inner">
108
106
  # <a class="brand" href="/">Title</a>
data/lib/navigasmic.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'navigasmic/version'
2
2
  require 'navigasmic/rails'
3
3
 
4
- require 'navigasmic/core/builders'
4
+ require 'navigasmic/core/builder'
5
5
  require 'navigasmic/core/configuration'
6
6
  require 'navigasmic/core/item'
@@ -40,11 +40,15 @@ module Navigasmic::Builder
40
40
  content_tag(@config.wrapper_tag, capture(&@definition), @options)
41
41
  end
42
42
 
43
- def group(label = nil, options = {}, &block)
43
+ def group(label_or_options = nil, options = {}, &block)
44
44
  raise ArgumentError, "Missing block for group" unless block_given?
45
+ if label_or_options.is_a?(Hash)
46
+ options = label_or_options
47
+ label_or_options = nil
48
+ end
45
49
  return '' unless visible?(options)
46
50
 
47
- concat(structure_for(label, false, options, &block))
51
+ concat(structure_for(label_or_options, false, options, &block))
48
52
  end
49
53
 
50
54
  def item(label, *args, &block)
@@ -52,7 +56,7 @@ module Navigasmic::Builder
52
56
  options = flatten_and_eval_options(options)
53
57
  return '' unless visible?(options)
54
58
 
55
- item = Navigasmic::Item.new(self, label, extract_and_determine_link(label, options, *args), options)
59
+ item = Navigasmic::Item.new(label, extract_and_determine_link(label, options, *args), visible?(options), options)
56
60
 
57
61
  merge_classes!(options, @config.disabled_class) if item.disabled?
58
62
  merge_classes!(options, @config.highlighted_class) if item.highlights_on?(@context.request.path, @context.params)
@@ -4,6 +4,8 @@ module Navigasmic::Builder
4
4
 
5
5
  attr_accessor :option_namespace
6
6
  attr_accessor :wrapper_tag, :group_tag, :item_tag, :label_generator
7
+ attr_accessor :xmlns, :xmlns_xsi, :schema_location
8
+ attr_accessor :changefreq, :item_changefreq
7
9
 
8
10
  def initialize
9
11
  # where you want the changefreq and other options to be looked for
@@ -13,16 +15,25 @@ module Navigasmic::Builder
13
15
  @wrapper_tag = :urlset
14
16
  @item_tag = :url
15
17
 
18
+ # xml namespace / schema
19
+ @xmlns = 'http://www.sitemaps.org/schemas/sitemap/0.9'
20
+ @xmlns_xsi = 'http://www.w3.org/2001/XMLSchema-instance'
21
+ @schema_location = 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'
22
+
23
+ # misc defaults
24
+ @changefreq = 'yearly'
25
+ @item_changefreq = 'yearly'
26
+
16
27
  super
17
28
  end
18
29
  end
19
30
 
20
31
  def initialize(context, name, options, &block)
21
32
  super
22
- @options['xmlns'] ||= 'http://www.sitemaps.org/schemas/sitemap/0.9'
23
- @options['xmlns:xsi'] ||= 'http://www.w3.org/2001/XMLSchema-instance'
24
- @options['xsi:schemaLocation'] ||= 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'
25
- @options[:changefreq] ||= 'yearly'
33
+ @options['xmlns'] ||= @config.xmlns
34
+ @options['xmlns:xsi'] ||= @config.xmlns_xsi
35
+ @options['xsi:schemaLocation'] ||= @config.schema_location
36
+ @options[:changefreq] ||= @config.changefreq
26
37
  end
27
38
 
28
39
  def render
@@ -41,7 +52,7 @@ module Navigasmic::Builder
41
52
  options = flatten_and_eval_options(options)
42
53
  return '' unless visible?(options)
43
54
 
44
- item = Navigasmic::Item.new(self, label, extract_and_determine_link(label, options, *args), options)
55
+ item = Navigasmic::Item.new(label, extract_and_determine_link(label, options, *args), visible?(options), options)
45
56
 
46
57
  concat(capture(&block)) if block_given?
47
58
  return '' unless item.link?
@@ -55,7 +66,7 @@ module Navigasmic::Builder
55
66
  content = content_tag(:loc, link_for(link, options))
56
67
  content << content_tag(:name, label)
57
68
  if opts = options.delete(@config.option_namespace)
58
- content << content_tag(:changefreq, opts[:changefreq] || 'yearly')
69
+ content << content_tag(:changefreq, opts[:changefreq] || @config.item_changefreq)
59
70
  content << content_tag(:lastmod, opts[:lastmod]) if opts.has_key?(:lastmod)
60
71
  content << content_tag(:priority, opt[:priority]) if opts.has_key?(:priority)
61
72
  end
@@ -67,8 +78,9 @@ module Navigasmic::Builder
67
78
  host = options.delete(:host) || @context.request.host
68
79
  if link.is_a?(Hash)
69
80
  link[:host] ||= host
70
- else
71
- link = "#{@context.request.protocol}#{host}#{@context.request.port}#{link}"
81
+ elsif link[0] == '/'
82
+ port = @context.request.port == 80 ? '' : ":#{@context.request.port}"
83
+ link = "#{@context.request.protocol}#{host}#{port}#{link}"
72
84
  end
73
85
  url_for(link)
74
86
  end
@@ -18,7 +18,7 @@ module Navigasmic::Builder
18
18
  raise ArgumentError, "Missing block or configuration" unless @definition
19
19
 
20
20
  @context, @name, @options = context, name, options
21
- @config = configuration_or_default
21
+ @config = configuration_or_default(@options.delete(:config))
22
22
  remove_excluded_options(@options)
23
23
  end
24
24
 
@@ -26,7 +26,7 @@ module Navigasmic::Builder
26
26
  raise "Expected subclass to implement group"
27
27
  end
28
28
 
29
- def item(label, *args, &block)
29
+ def item(label = nil, *args, &block)
30
30
  raise "Expected subclass to implement item"
31
31
  end
32
32
 
@@ -36,9 +36,9 @@ module Navigasmic::Builder
36
36
 
37
37
  private
38
38
 
39
- def configuration_or_default
39
+ def configuration_or_default(config = nil)
40
40
  configurations = Navigasmic.configuration.builder_configurations[self.class.to_s]
41
- proc = configurations.present? ? configurations[@options.delete(:config) || :default] : nil
41
+ proc = configurations.present? ? configurations[config || :default] : nil
42
42
  self.class::Configuration.new(&proc)
43
43
  end
44
44
 
@@ -1,13 +1,12 @@
1
1
  class Navigasmic::Item
2
2
 
3
3
  attr_accessor :link
4
- def initialize(builder, label, link, options = {})
5
- @label, @link = label, link
4
+ def initialize(label, link, visible, options = {})
5
+ @label, @link, @visible = label, link, visible
6
6
  @disabled = options.delete(:disabled_if)
7
- @visible = builder.send(:visible?, options)
8
7
  options.delete(:hidden_unless)
9
8
 
10
- highlighting_from(options.delete(:highlights_on))
9
+ @rules = calculate_highlighting_rules(options.delete(:highlights_on))
11
10
  end
12
11
 
13
12
  def hidden?
@@ -26,16 +25,16 @@ class Navigasmic::Item
26
25
  params = clean_unwanted_keys(params)
27
26
  result = false
28
27
 
29
- @highlights_on.each do |highlight|
28
+ @rules.each do |rule|
30
29
  highlighted = true
31
30
 
32
- case highlight
33
- when String then highlighted &= path == highlight
34
- when Regexp then highlighted &= path.match(highlight)
35
- when TrueClass then highlighted &= highlight
36
- when FalseClass then highlighted &= highlight
31
+ case rule
32
+ when String then highlighted &= path == rule
33
+ when Regexp then highlighted &= path.match(rule)
34
+ when TrueClass then highlighted &= rule
35
+ when FalseClass then highlighted &= rule
37
36
  when Hash
38
- clean_unwanted_keys(highlight).each do |key, value|
37
+ clean_unwanted_keys(rule).each do |key, value|
39
38
  value.gsub!(/^\//, '') if key == :controller
40
39
  highlighted &= value == params[key].to_s
41
40
  end
@@ -50,12 +49,12 @@ class Navigasmic::Item
50
49
 
51
50
  private
52
51
 
53
- def highlighting_from(rules)
54
- @highlights_on = []
55
- @highlights_on << @link if link?
52
+ def calculate_highlighting_rules(rules)
53
+ highlighting_rules = []
54
+ highlighting_rules << @link if link?
56
55
 
57
- return if rules.blank?
58
- @highlights_on += rules.kind_of?(Array) ? rules : [rules]
56
+ return [] if highlighting_rules.blank?
57
+ highlighting_rules += Array(rules)
59
58
  end
60
59
 
61
60
  def clean_unwanted_keys(hash)
@@ -1,3 +1,3 @@
1
1
  module Navigasmic
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -0,0 +1,66 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Navigasmic::Builder::ListBuilder', type: :helper do
4
+
5
+ subject { Navigasmic::Builder::ListBuilder }
6
+
7
+ def clean(string)
8
+ string.gsub(/\n(\s+)|\n|^\s+/, '')
9
+ end
10
+
11
+ describe "rendering" do
12
+
13
+ it "outputs basic example" do
14
+ builder = subject.new helper, :primary, {} do |n|
15
+ n.group(class: 'group') { n.item "Label", '/path' }
16
+ n.item('Level 1', class: 'item') { n.item 'Level 2' }
17
+ end
18
+
19
+ html = <<-HTML
20
+ <ul class="semantic-navigation" id="primary">
21
+ <li class="group has-nested">
22
+ <ul class="is-nested">
23
+ <li><a href="/path"><span>Label</span></a></li>
24
+ </ul>
25
+ </li>
26
+ <li class="item has-nested">
27
+ <span>Level 1</span>
28
+ <ul class="is-nested">
29
+ <li><span>Level 2</span></li>
30
+ </ul>
31
+ </li>
32
+ </ul>
33
+ HTML
34
+
35
+ builder.render.should match(clean(html))
36
+ end
37
+
38
+ it "handles builder configurations" do
39
+ builder = subject.new helper, :primary, {config: :bootstrap} do |n|
40
+ n.group('Group', class: 'group') { n.item "Label", '/path' }
41
+ n.item('Level 1', class: 'item') { n.item 'Level 2' }
42
+ n.item('Foo')
43
+ end
44
+
45
+ html = <<-HTML
46
+ <ul class="nav nav-pills" id="primary">
47
+ <li class="group dropdown">
48
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Group<b class='caret'></b></a>
49
+ <ul class="dropdown-menu">
50
+ <li><a href="/path"><span>Label</span></a></li>
51
+ </ul>
52
+ </li>
53
+ <li class="item dropdown">
54
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Level 1<b class='caret'></b></a>
55
+ <ul class="dropdown-menu">
56
+ <li><span>Level 2</span></li>
57
+ </ul>
58
+ </li>
59
+ <li><span>Foo</span></li>
60
+ </ul>
61
+ HTML
62
+
63
+ builder.render.should match(clean(html))
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Navigasmic::Builder::MapBuilder', type: :helper do
4
+
5
+ subject { Navigasmic::Builder::MapBuilder }
6
+
7
+ def clean(string)
8
+ string.gsub(/\n(\s+)|\n|^\s+/, '')
9
+ end
10
+
11
+ describe "rendering" do
12
+
13
+ it "outputs basic example" do
14
+ builder = subject.new helper, :primary, {} do |n|
15
+ n.group(class: 'group') { n.item "Label", '/path' }
16
+ n.item('Level 1', class: 'item') { n.item 'Level 2' }
17
+ end
18
+
19
+ xml = <<-XML
20
+ <urlset changefreq="yearly" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
21
+ <url>
22
+ <loc>http://test.host/path</loc>
23
+ <name>Label</name>
24
+ </url>
25
+ </urlset>
26
+ XML
27
+
28
+ builder.render.should match(clean(xml))
29
+ end
30
+
31
+ it "handles builder configurations" do
32
+ builder = subject.new helper, :primary, {changefreq: 'weekly'} do |n|
33
+ n.group('Group', class: 'group') { n.item "Label", '/path' }
34
+ n.item('Level 1', class: 'item') { n.item 'Level 2' }
35
+ n.item('Foo', '/other_path')
36
+ end
37
+
38
+ xml = <<-XML
39
+ <urlset changefreq="weekly" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
40
+ <url>
41
+ <loc>http://test.host/path</loc>
42
+ <name>Label</name>
43
+ </url>
44
+ <url>
45
+ <loc>http://test.host/other_path</loc>
46
+ <name>Foo</name>
47
+ </url>
48
+ </urlset>
49
+ XML
50
+
51
+ builder.render.should match(clean(xml))
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Navigasmic::Builder::Base', type: :helper do
4
+
5
+ subject { Navigasmic::Builder::Base.new(helper, :primary, {}) {} }
6
+
7
+ describe "#group" do
8
+
9
+ it "raises" do
10
+ lambda { subject.group }.should raise_error('Expected subclass to implement group')
11
+ end
12
+
13
+ end
14
+
15
+ describe "#item" do
16
+
17
+ it "raises" do
18
+ lambda { subject.item }.should raise_error('Expected subclass to implement item')
19
+ end
20
+
21
+ end
22
+
23
+ describe "#render" do
24
+
25
+ it "raises" do
26
+ lambda { subject.render }.should raise_error('Expected subclass to implement render')
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,56 @@
1
+ require 'spec_helper'
2
+
3
+ describe Navigasmic do
4
+
5
+ it "has a configuration property" do
6
+ Navigasmic.configuration.should be(Navigasmic::Configuration)
7
+ end
8
+
9
+ describe ".setup" do
10
+
11
+ it "is defined" do
12
+ Navigasmic.methods.should include(:setup)
13
+ end
14
+
15
+ it "yields configuration" do
16
+ config = nil
17
+ Navigasmic.setup { |c| config = c }
18
+ config.should be(Navigasmic::Configuration)
19
+ end
20
+
21
+ end
22
+
23
+ describe Navigasmic::Configuration do
24
+
25
+ subject { Navigasmic::Configuration }
26
+
27
+ it "sets the default_builder to ListBuilder" do
28
+ subject.default_builder.should be(Navigasmic::Builder::ListBuilder)
29
+ end
30
+
31
+ it "allows configuring builders" do
32
+ subject.builder_configurations.should be_a(Hash)
33
+ subject.builder_configurations.should include('Navigasmic::Builder::ListBuilder')
34
+
35
+ subject.builder test_config: Navigasmic::Builder::ListBuilder do
36
+ end
37
+
38
+ subject.builder_configurations['Navigasmic::Builder::ListBuilder'].should include(:test_config)
39
+ subject.builder_configurations['Navigasmic::Builder::ListBuilder'][:test_config].should be_a(Proc)
40
+ end
41
+
42
+ it "allows naming builder configurations" do
43
+ end
44
+
45
+ it "allows defining navigation structures" do
46
+ subject.definitions.should be_a(Hash)
47
+ subject.definitions.should include(:primary)
48
+
49
+ subject.semantic_navigation :test_definition do
50
+ end
51
+
52
+ subject.definitions.should include(:test_definition)
53
+ subject.definitions[:test_definition].should be_a(Proc)
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,90 @@
1
+ require 'spec_helper'
2
+
3
+ describe Navigasmic::Item do
4
+
5
+ subject { Navigasmic::Item }
6
+
7
+ describe "#hidden?" do
8
+
9
+ it "returns true when it's not visible" do
10
+ item = subject.new 'Label', {controller: 'controller'}, false
11
+ item.hidden?.should be(true)
12
+ end
13
+
14
+ it "returns false when it's visible" do
15
+ item = subject.new 'Label', {controller: 'controller'}, true
16
+ item.hidden?.should be(false)
17
+ end
18
+
19
+ end
20
+
21
+ describe "#disabled?" do
22
+
23
+ it "returns true when it's disabled" do
24
+ item = subject.new 'Label', {controller: 'controller'}, true, disabled_if: true
25
+ item.disabled?.should be(true)
26
+ end
27
+
28
+ it "returns false when it's not disabled" do
29
+ item = subject.new 'Label', {controller: 'controller'}, true, disabled_if: false
30
+ item.disabled?.should be(false)
31
+ end
32
+
33
+ end
34
+
35
+ describe "#link?" do
36
+
37
+ it "returns true when there's a link" do
38
+ item = subject.new 'Label', 'url', true
39
+ item.link?.should be(true)
40
+ end
41
+
42
+ it "returns false when there isn't a link" do
43
+ item = subject.new 'Label', nil, true
44
+ item.link?.should be(false)
45
+ end
46
+
47
+ it "returns false when it's disabled" do
48
+ item = subject.new 'Label', nil, true, disabled_if: true
49
+ item.link?.should be(false)
50
+ end
51
+
52
+ end
53
+
54
+ describe "#highlights_on?" do
55
+
56
+ it "uses it's own link (as a string)" do
57
+ item = subject.new 'Label', '/path', true
58
+ item.highlights_on?('/path', {}).should be(true)
59
+ item.highlights_on?('/other_path', {}).should be(false)
60
+ end
61
+
62
+ it "uses it's own path (as hash)" do
63
+ item = subject.new 'Label', {controller: 'foo'}, true
64
+ item.highlights_on?('/path', {controller: 'foo'}).should be(true)
65
+ item.highlights_on?('/other_path', {controller: 'bar'}).should be(false)
66
+ end
67
+
68
+ it "handles strings" do
69
+ item = subject.new 'Label', '/foo', true, highlights_on: '/path'
70
+ item.highlights_on?('/path', {}).should be(true)
71
+ item.highlights_on?('/other_path', {}).should be(false)
72
+ end
73
+
74
+ it "handles regexp" do
75
+ item = subject.new 'Label', '/foo', true, highlights_on: /^\/pa/
76
+ item.highlights_on?('/path', {}).should be(true)
77
+ item.highlights_on?('/other_path', {}).should be(false)
78
+ end
79
+
80
+ it "handles true/false" do
81
+ item = subject.new 'Label', '/foo', true, highlights_on: true
82
+ item.highlights_on?('/path', {}).should be(true)
83
+ item.highlights_on?('/other_path', {}).should be(true)
84
+
85
+ item = subject.new 'Label', '/foo', true, highlights_on: false
86
+ item.highlights_on?('/path', {}).should be(false)
87
+ item.highlights_on?('/other_path', {}).should be(false)
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Navigasmic do
4
+
5
+ it "is a module" do
6
+ Navigasmic.should be_a(Module)
7
+ end
8
+
9
+ it "has a version" do
10
+ Navigasmic::VERSION.should be_a(String)
11
+ end
12
+
13
+ it "defines ViewHelpers" do
14
+ Navigasmic::ViewHelpers.should be_a(Module)
15
+ end
16
+
17
+ it "includes ViewHelpers in ActionView::Base" do
18
+ ActionView::Base.new.methods.should include(:semantic_navigation)
19
+ end
20
+
21
+ end
File without changes
data/spec/spec_helper.rb CHANGED
@@ -7,7 +7,7 @@ require 'rspec/autorun'
7
7
 
8
8
  # Requires supporting ruby files with custom matchers and macros, etc,
9
9
  # in spec/support/ and its subdirectories.
10
- Dir[Temporal::Engine.root.join('spec/support/**/*.rb')].each { |f| require f }
10
+ Dir[Navigasmic::Engine.root.join('spec/support/**/*.rb')].each { |f| require f }
11
11
 
12
12
  RSpec.configure do |config|
13
13
  # ## Mock Framework
@@ -19,12 +19,12 @@ RSpec.configure do |config|
19
19
  # config.mock_with :rr
20
20
 
21
21
  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
22
- config.fixture_path = "#{::Temporal::Engine.root}/spec/fixtures"
22
+ #config.fixture_path = "#{::Navigasmic::Engine.root}/spec/fixtures"
23
23
 
24
24
  # If you're not using ActiveRecord, or you'd prefer not to run each of your
25
25
  # examples within a transaction, remove the following line or assign false
26
26
  # instead of true.
27
- config.use_transactional_fixtures = true
27
+ #config.use_transactional_fixtures = true
28
28
 
29
29
  # If true, the base class of anonymous controllers will be inferred
30
30
  # automatically. This will be the default behavior in future versions of
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: navigasmic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-14 00:00:00.000000000 Z
12
+ date: 2012-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -58,7 +58,7 @@ files:
58
58
  - lib/navigasmic/builders/crumb_builder.rb
59
59
  - lib/navigasmic/builders/list_builder.rb
60
60
  - lib/navigasmic/builders/map_builder.rb
61
- - lib/navigasmic/core/builders.rb
61
+ - lib/navigasmic/core/builder.rb
62
62
  - lib/navigasmic/core/configuration.rb
63
63
  - lib/navigasmic/core/item.rb
64
64
  - lib/navigasmic/rails/engine.rb
@@ -67,6 +67,11 @@ files:
67
67
  - lib/navigasmic/version.rb
68
68
  - lib/navigasmic.rb
69
69
  - LICENSE
70
+ - spec/builders/list_builder_spec.rb
71
+ - spec/builders/map_builder_spec.rb
72
+ - spec/core/builder_spec.rb
73
+ - spec/core/configuration_spec.rb
74
+ - spec/core/item_spec.rb
70
75
  - spec/dummy/Rakefile
71
76
  - spec/dummy/app/controllers/application_controller.rb
72
77
  - spec/dummy/app/controllers/blog/links_controller.rb
@@ -98,6 +103,8 @@ files:
98
103
  - spec/dummy/public/favicon.ico
99
104
  - spec/dummy/public/jquery.min.js
100
105
  - spec/dummy/script/rails
106
+ - spec/rails/engine_spec.rb
107
+ - spec/rails/view_helpers_spec.rb
101
108
  - spec/spec_helper.rb
102
109
  homepage: http://github.com/jejacks0n/navigasmic
103
110
  licenses:
@@ -114,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
121
  version: '0'
115
122
  segments:
116
123
  - 0
117
- hash: 1970489066529274400
124
+ hash: 185969563685699556
118
125
  required_rubygems_version: !ruby/object:Gem::Requirement
119
126
  none: false
120
127
  requirements:
@@ -123,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
130
  version: '0'
124
131
  segments:
125
132
  - 0
126
- hash: 1970489066529274400
133
+ hash: 185969563685699556
127
134
  requirements: []
128
135
  rubyforge_project:
129
136
  rubygems_version: 1.8.24
@@ -131,6 +138,11 @@ signing_key:
131
138
  specification_version: 3
132
139
  summary: ! 'Navigasmic: Semantic navigation for Rails'
133
140
  test_files:
141
+ - spec/builders/list_builder_spec.rb
142
+ - spec/builders/map_builder_spec.rb
143
+ - spec/core/builder_spec.rb
144
+ - spec/core/configuration_spec.rb
145
+ - spec/core/item_spec.rb
134
146
  - spec/dummy/Rakefile
135
147
  - spec/dummy/app/controllers/application_controller.rb
136
148
  - spec/dummy/app/controllers/blog/links_controller.rb
@@ -162,4 +174,6 @@ test_files:
162
174
  - spec/dummy/public/favicon.ico
163
175
  - spec/dummy/public/jquery.min.js
164
176
  - spec/dummy/script/rails
177
+ - spec/rails/engine_spec.rb
178
+ - spec/rails/view_helpers_spec.rb
165
179
  - spec/spec_helper.rb