rails_utils 2.1.4 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5430a55c9e22130e67147ad9835b375c0059383
4
- data.tar.gz: d7f5c3f81298658b9f1ca60cd950ccbd73dad61a
3
+ metadata.gz: 2aa6c40f062ba83c318a29281a4e2a2ef1d3c755
4
+ data.tar.gz: a0a431d9899c860b41a49f0e20aa312610adc984
5
5
  SHA512:
6
- metadata.gz: 5a4c92020b8159db288b40c47c325e62e7972773f45dd16c6dd81e7251e58c5a2e0460737b74a77d5b4aac60731fbf8ac34ba25d9564d4a22cf411707412f407
7
- data.tar.gz: eb1838900dc3a981b4f4f49ac9f32ad40591f2e987a137a0afb832b42698e273e6201d343275801b1a0aecb699639f822986a9f7c40f127a6acbf7cc679d31e8
6
+ metadata.gz: c3cd04591dc63ad0edfb23024b8a021fd6d980bd146166a78837d2833e8395a53a901b6e4204875ab11b2175264daee1359a0d1e871d335f93cec1a822336a58
7
+ data.tar.gz: 3c2d7e0f07f14287f9e86f848c04eecbb10a97d389ef5808ff238639b474d2f3c85d6a03d1e9f14eab4bf3c8e5db421dff76d1ce4adbbfeed2cdc7a0113c1859
data/README.markdown CHANGED
@@ -93,6 +93,11 @@ Pull Requests are very welcomed (with specs, of course)!
93
93
 
94
94
  Minitest-ed. To run all tests, just run `rake` or `rake test`.
95
95
 
96
+ ## Changelog
97
+
98
+ _Version 3.0.0_
99
+
100
+ - Controller namespace added to `page_class` and `javascript_initialization`.
96
101
 
97
102
  ## Author
98
103
 
data/lib/rails_utils.rb CHANGED
@@ -3,7 +3,7 @@ require 'action_view'
3
3
  module RailsUtils
4
4
  module ActionViewExtensions
5
5
  def page_controller_class
6
- controller.controller_name
6
+ controller.class.to_s.underscore.sub(/Controller$/, "").sub(/\//, "_")
7
7
  end
8
8
 
9
9
  def page_action_class
@@ -1,3 +1,3 @@
1
1
  module RailsUtils
2
- VERSION = "2.1.4"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -11,12 +11,26 @@ describe "RailsUtils::ActionViewExtensions" do
11
11
  end
12
12
 
13
13
  describe "#page_controller_class" do
14
- let(:controller_name) { "anime" }
14
+ describe "simple controller" do
15
+ let(:controller_class) { "Anime" }
16
+ let(:controller_name) { "anime" }
17
+
18
+ before { controller.stubs(:class).returns(controller_class) }
19
+
20
+ it "returns controller name" do
21
+ view.page_controller_class.must_equal controller_name
22
+ end
23
+ end
24
+
25
+ describe "simple controller" do
26
+ let(:controller_class) { "Awesome::Anime" }
27
+ let(:controller_name) { "awesome_anime" }
15
28
 
16
- before { controller.stubs(:controller_name).returns(controller_name) }
29
+ before { controller.stubs(:class).returns(controller_class) }
17
30
 
18
- it "returns controller name" do
19
- view.page_controller_class.must_equal controller_name
31
+ it "returns controller name" do
32
+ view.page_controller_class.must_equal controller_name
33
+ end
20
34
  end
21
35
  end
22
36
 
@@ -57,10 +71,11 @@ describe "RailsUtils::ActionViewExtensions" do
57
71
  end
58
72
 
59
73
  describe "#javascript_initialization" do
60
- let(:controller_name) { "anime" }
74
+ let(:controller_class) { "Awesome::Anime" }
75
+ let(:controller_name) { "awesome_anime" }
61
76
 
62
77
  before do
63
- controller.stubs(:controller_name).returns(controller_name)
78
+ controller.stubs(:class).returns(controller_class)
64
79
  controller.stubs(:action_name).returns(action_name)
65
80
  end
66
81
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winston Teo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-09 00:00:00.000000000 Z
11
+ date: 2014-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  requirements: []
131
131
  rubyforge_project:
132
- rubygems_version: 2.0.7
132
+ rubygems_version: 2.0.6
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Rails helpers based on opinionated project practices.