current 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ begin
10
10
  gem.email = "stevendgarcia@gmail.com"
11
11
  gem.homepage = "http://github.com/activestylus/current"
12
12
  gem.authors = ["Steven Garcia"]
13
- gem.version = "1.0.4"
13
+ gem.version = "1.0.5"
14
14
  gem.add_development_dependency "shoulda", ">= 0"
15
15
  gem.add_development_dependency "mocha", ">= 0"
16
16
  gem.add_development_dependency "rails", ">= 0"
data/current.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{current}
8
- s.version = "1.0.4"
8
+ s.version = "1.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Steven Garcia"]
data/lib/current.rb CHANGED
@@ -1,28 +1,23 @@
1
1
  module Current
2
2
 
3
- def controller_is(*attrs)
3
+ def controller_is?(*attrs)
4
4
  attrs.collect{|attr| attr.to_s}.include?(controller_name)
5
- alias_method :controller_is?, :controller_is
6
5
  end
7
6
 
8
- def action_is(*attrs)
7
+ def action_is?(*attrs)
9
8
  attrs.map{|attr| attr.to_s}.include?(action_name)
10
- alias_method :action_is?, :action_is
11
9
  end
12
10
 
13
- def partial_is(param)
11
+ def partial_is?(param)
14
12
  param == params[:partial]
15
- alias_method :partial_is?, :partial_is
16
13
  end
17
14
 
18
- def controller_action_is(c,a)
15
+ def controller_action_is?(c,a)
19
16
  controller_is(c) && action_is(a)
20
- alias_method :controller_action_is?, :controller_action_is
21
17
  end
22
18
 
23
- def active_if(condition)
19
+ def active_if?(condition)
24
20
  condition ? "active" : "inactive"
25
- alias_method :active_if?, :active_if
26
21
  end
27
22
 
28
23
  def nav_link_to(text,path,condition, options={})
data/test/test_current.rb CHANGED
@@ -28,61 +28,61 @@ class TestCurrent < ActionView::TestCase
28
28
  self.stubs(:action_name).returns('new')
29
29
  end
30
30
 
31
- context "controller_is" do
31
+ context "controller_is?" do
32
32
  should "be true for users" do
33
- assert controller_is('users')
33
+ assert controller_is?('users')
34
34
  end
35
35
 
36
36
  should "be true for users/new" do
37
- assert controller_is('users', 'new')
37
+ assert controller_is?('users', 'new')
38
38
  end
39
39
 
40
40
  should "be false for jobs" do
41
- assert !controller_is('jobs')
41
+ assert !controller_is?('jobs')
42
42
  end
43
43
  end
44
44
 
45
- context "action_is" do
45
+ context "action_is?" do
46
46
  should "be true if current action is in the supplied list" do
47
- assert action_is('new')
48
- assert action_is('new', 'edit')
47
+ assert action_is?('new')
48
+ assert action_is?('new', 'edit')
49
49
  end
50
50
 
51
51
  should "be false if current action is not in the supplied list" do
52
- assert !action_is('edit')
52
+ assert !action_is?('edit')
53
53
  end
54
54
  end
55
55
 
56
- context "partial_is" do
56
+ context "partial_is?" do
57
57
  should "be true if params[:partial] is the specified value" do
58
58
  self.stubs(:params).returns({ :partial => 'boards' })
59
- assert partial_is('boards')
59
+ assert partial_is?('boards')
60
60
  end
61
61
 
62
62
  should "be false if params[:partial] is not the specified value" do
63
63
  self.stubs(:params).returns({ :partial => 'askjfafew' })
64
- assert !partial_is('boards')
64
+ assert !partial_is?('boards')
65
65
  end
66
66
  end
67
67
 
68
- context "controller_action_is" do
68
+ context "controller_action_is?" do
69
69
  should "be true if for current controller/action combination" do
70
- assert controller_action_is('users', 'new')
70
+ assert controller_action_is?('users', 'new')
71
71
  end
72
72
 
73
73
  should "be false for incorrect controller/action combination" do
74
- assert !controller_action_is('accounts', 'edit')
75
- assert !controller_action_is('jobs', 'new')
74
+ assert !controller_action_is?('accounts', 'edit')
75
+ assert !controller_action_is?('jobs', 'new')
76
76
  end
77
77
  end
78
78
 
79
- context "active_if" do
79
+ context "active_if?" do
80
80
  should "return active if true" do
81
- assert_equal 'active', active_if(true)
81
+ assert_equal 'active', active_if?(true)
82
82
  end
83
83
 
84
84
  should "return inactive if false" do
85
- assert_equal 'inactive', active_if(false)
85
+ assert_equal 'inactive', active_if?(false)
86
86
  end
87
87
  end
88
88
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: current
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 4
10
- version: 1.0.4
9
+ - 5
10
+ version: 1.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steven Garcia