tabnav 1.0.1 → 1.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/Rakefile CHANGED
@@ -15,6 +15,7 @@ begin
15
15
  gem.add_development_dependency "rspec-rails", ">= 1.2.9"
16
16
  gem.files.exclude "*.gemspec", '.gitignore', 'doc/*'
17
17
  end
18
+ Jeweler::GemcutterTasks.new
18
19
  rescue LoadError
19
20
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
21
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
data/lib/tabnav/tab.rb CHANGED
@@ -18,6 +18,11 @@ module Tabnav
18
18
  # The link options (if any)
19
19
  attr_accessor :link_options
20
20
 
21
+ # Returns true if this tab has had a link set on it.
22
+ def has_link?
23
+ !! @link_url
24
+ end
25
+
21
26
  # Sets the name of this tab. This will be used as the contents of the link or span
22
27
  def named(text)
23
28
  @name = text
@@ -58,7 +63,7 @@ module Tabnav
58
63
  @template.content_tag(:li, @html_options) do
59
64
  if partial
60
65
  @template.render :partial => partial, :locals => {:tab => self}
61
- elsif @link_url
66
+ elsif has_link?
62
67
  @template.link_to @name, @link_url, @link_options
63
68
  else
64
69
  @template.content_tag :span, @name
@@ -6,7 +6,6 @@ describe Tabnav::Tab do
6
6
  before :each do
7
7
  @tab = Tabnav::Tab.new(nil, {})
8
8
  @tab.named "A Tab"
9
- @tab.links_to "/somewhere", :target => "_blank"
10
9
  end
11
10
 
12
11
  it "should have a name accessor" do
@@ -14,12 +13,25 @@ describe Tabnav::Tab do
14
13
  end
15
14
 
16
15
  it "should have a link_url accessor" do
16
+ @tab.links_to "/somewhere", :target => "_blank"
17
17
  @tab.link_url.should == "/somewhere"
18
18
  end
19
19
 
20
20
  it "should have a link_options accessor" do
21
+ @tab.links_to "/somewhere", :target => "_blank"
21
22
  @tab.link_options.should == {:target => "_blank"}
22
23
  end
24
+
25
+ describe "has_link?" do
26
+ it "should return true if a link url has been set" do
27
+ @tab.links_to "/somewhere"
28
+ @tab.has_link?.should == true
29
+ end
30
+
31
+ it "should return false otherwise" do
32
+ @tab.has_link?.should == false
33
+ end
34
+ end
23
35
  end
24
36
 
25
37
  describe "render" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tabnav
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Unboxed
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-29 00:00:00 +01:00
18
+ date: 2010-07-30 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency