cpb-generators 0.1.0 → 0.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6434d531210bbe68b924f68261e48c0240d7496d
|
4
|
+
data.tar.gz: cc4a5914f47d335adfd0806c9189404baa955fbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65bb66ea286ff2406faf18b0b9f8c585728ba09207084b27513f9cf328fd0a35e13e313b0f2afae14064f136a0a9486fe5570c92b5555412aeedc7d78caedc3d
|
7
|
+
data.tar.gz: 3e4eb1393727e71607953604c2e0e1440b5b9c3263e73455e718e9323b3136f5709f735c403da43a2c7930e83fc5c3eef544f9a0568e3174e52ce914ebb9c2cf
|
data/features/readme.feature
CHANGED
@@ -9,9 +9,9 @@ Feature: I can install cpb-generators and generate files
|
|
9
9
|
end
|
10
10
|
"""
|
11
11
|
And I run `bundle install`
|
12
|
-
When I run `bundle exec cpb entity namespace/new_name`
|
13
|
-
Then a file named "lib/namespace/new_name.rb" should exist
|
14
|
-
And a file named "spec/namespace/new_name_spec.rb" should exist
|
12
|
+
When I run `bundle exec cpb entity many/namespace/new_name`
|
13
|
+
Then a file named "lib/many/namespace/new_name.rb" should exist
|
14
|
+
And a file named "spec/many/namespace/new_name_spec.rb" should exist
|
15
15
|
|
16
16
|
Scenario: Usage post installation
|
17
17
|
Given a Gemfile setup with:
|
@@ -20,6 +20,7 @@ Feature: I can install cpb-generators and generate files
|
|
20
20
|
gem 'cpb-generators', path: '../..'
|
21
21
|
end
|
22
22
|
"""
|
23
|
-
And I run `bundle exec cpb entity namespace/class_name`
|
23
|
+
And I run `bundle exec cpb entity many/namespace/class_name`
|
24
24
|
When I run `bundle exec rspec`
|
25
25
|
Then the output should contain "pending"
|
26
|
+
Then the output should contain "Many::Namespace::ClassName"
|
@@ -42,10 +42,9 @@ module Cpb
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def verbose_namespace_definition(name)
|
45
|
-
first_part, parts = described_class(name).split("::").reverse
|
45
|
+
first_part, *parts = described_class(name).split("::").reverse
|
46
46
|
|
47
|
-
|
48
|
-
parts = Array(parts)
|
47
|
+
unless parts.empty?
|
49
48
|
i = parts.length
|
50
49
|
parts.inject(lambda { "#{tabs(parts.length)}class #{first_part}\n#{tabs(parts.length)}end\n" }) do |memo, namespace|
|
51
50
|
lambda do
|
@@ -14,6 +14,18 @@ describe Cpb::Generators::ClassGenerator do
|
|
14
14
|
capture(:stdout) { gen.invoke_all }
|
15
15
|
end
|
16
16
|
|
17
|
+
describe 'deep namespacing' do
|
18
|
+
before do
|
19
|
+
run_generator %w(many/namespaces/here)
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'the spec' do
|
23
|
+
subject { file('lib/many/namespaces/here.rb') }
|
24
|
+
|
25
|
+
it { should contain(/module Many/) }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
17
29
|
describe 'the generated files' do
|
18
30
|
before do
|
19
31
|
run_generator %w(posts)
|