r3_plugin_toolbox 0.3.8 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/r3_plugin_toolbox/rspec/macro.rb +18 -0
- data/lib/r3_plugin_toolbox/rspec/matchers/be_extended_with.rb +1 -1
- data/r3_plugin_toolbox.gemspec +5 -1
- data/spec/r3_plugin_toolbox/engine_macro_spec.rb +17 -0
- data/spec/r3_plugin_toolbox/extender/extender_macro_view_spec.rb +63 -0
- metadata +6 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.10
|
@@ -7,6 +7,24 @@ module Rails3
|
|
7
7
|
end
|
8
8
|
|
9
9
|
MACRO = Rails3::Plugin::Extender::Macro
|
10
|
+
|
11
|
+
def with_engine name, &block
|
12
|
+
Rails3::Engine.new name do |e|
|
13
|
+
yield e
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def with_engine name, &block
|
18
|
+
Rails3::Engine.new name do |e|
|
19
|
+
yield e
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def with_extension &block
|
24
|
+
Rails3::Plugin::Extender.new do |e|
|
25
|
+
e.instance_eval(&block)
|
26
|
+
end
|
27
|
+
end
|
10
28
|
|
11
29
|
def after_init component, &block
|
12
30
|
type = MACRO.get_load_type component
|
data/r3_plugin_toolbox.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{r3_plugin_toolbox}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
@@ -39,10 +39,12 @@ Gem::Specification.new do |s|
|
|
39
39
|
"log/development.log",
|
40
40
|
"r3_plugin_toolbox.gemspec",
|
41
41
|
"spec/fixtures/extension_modules.rb",
|
42
|
+
"spec/r3_plugin_toolbox/engine_macro_spec.rb",
|
42
43
|
"spec/r3_plugin_toolbox/engine_spec.rb",
|
43
44
|
"spec/r3_plugin_toolbox/extender/extend_view_content_spec.rb",
|
44
45
|
"spec/r3_plugin_toolbox/extender/extender_action_spec.rb",
|
45
46
|
"spec/r3_plugin_toolbox/extender/extender_i18n_spec.rb",
|
47
|
+
"spec/r3_plugin_toolbox/extender/extender_macro_view_spec.rb",
|
46
48
|
"spec/r3_plugin_toolbox/extender_spec.rb",
|
47
49
|
"spec/r3_plugin_toolbox/railtie_spec.rb",
|
48
50
|
"spec/r3_plugin_toolbox/shortcuts_spec.rb",
|
@@ -58,10 +60,12 @@ Gem::Specification.new do |s|
|
|
58
60
|
s.summary = %q{Toolbox to facilitate Rails 3 plugin development}
|
59
61
|
s.test_files = [
|
60
62
|
"spec/fixtures/extension_modules.rb",
|
63
|
+
"spec/r3_plugin_toolbox/engine_macro_spec.rb",
|
61
64
|
"spec/r3_plugin_toolbox/engine_spec.rb",
|
62
65
|
"spec/r3_plugin_toolbox/extender/extend_view_content_spec.rb",
|
63
66
|
"spec/r3_plugin_toolbox/extender/extender_action_spec.rb",
|
64
67
|
"spec/r3_plugin_toolbox/extender/extender_i18n_spec.rb",
|
68
|
+
"spec/r3_plugin_toolbox/extender/extender_macro_view_spec.rb",
|
65
69
|
"spec/r3_plugin_toolbox/extender_spec.rb",
|
66
70
|
"spec/r3_plugin_toolbox/railtie_spec.rb",
|
67
71
|
"spec/r3_plugin_toolbox/shortcuts_spec.rb",
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Rails3::Engine do
|
5
|
+
it "should create an engine" do
|
6
|
+
with_engine :my_engine do |e|
|
7
|
+
e.add_locales_dir 'my_locales'
|
8
|
+
e.set_orm :active_record
|
9
|
+
end
|
10
|
+
|
11
|
+
# Initialize the rails application
|
12
|
+
init_app_railties :minimal
|
13
|
+
|
14
|
+
Rails.configuration.generators.options[:rails][:orm].should == :active_record
|
15
|
+
Minimal::Application.config.generators.options[:rails][:orm].should == :active_record
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'active_record'
|
4
|
+
require 'action_mailer'
|
5
|
+
|
6
|
+
module Helper
|
7
|
+
module View
|
8
|
+
module Panel
|
9
|
+
def draw_panel
|
10
|
+
'panel'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module Window
|
15
|
+
def draw_window
|
16
|
+
'panel'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module Button
|
21
|
+
def draw_button
|
22
|
+
'button'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module Form
|
27
|
+
def draw_form
|
28
|
+
'form'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe Rails3::Plugin::Extender do
|
35
|
+
describe '#extend_rails' do
|
36
|
+
|
37
|
+
before :each do
|
38
|
+
with_extension do
|
39
|
+
extend_rails :view do
|
40
|
+
extend_from_module Helper::View, :panel, :window
|
41
|
+
extend_with Helper::View::Button, Helper::View::Form
|
42
|
+
end
|
43
|
+
|
44
|
+
extend_rails :controller do
|
45
|
+
extend_from_module Helper::View, :panel
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should extend Action View" do
|
51
|
+
after_init :view do
|
52
|
+
puts "View initialized!"
|
53
|
+
|
54
|
+
:view.should be_extended_with Helper::View, :panel, :window, :button, :form
|
55
|
+
:view.should_not be_extended_with Helper::View, :unknown
|
56
|
+
|
57
|
+
lambda { :view.should be_extended_with Helper::View, :unknown }.should raise_error
|
58
|
+
end
|
59
|
+
|
60
|
+
init_app_railties :minimal, :view
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 10
|
9
|
+
version: 0.3.10
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristian Mandrup
|
@@ -96,10 +96,12 @@ files:
|
|
96
96
|
- log/development.log
|
97
97
|
- r3_plugin_toolbox.gemspec
|
98
98
|
- spec/fixtures/extension_modules.rb
|
99
|
+
- spec/r3_plugin_toolbox/engine_macro_spec.rb
|
99
100
|
- spec/r3_plugin_toolbox/engine_spec.rb
|
100
101
|
- spec/r3_plugin_toolbox/extender/extend_view_content_spec.rb
|
101
102
|
- spec/r3_plugin_toolbox/extender/extender_action_spec.rb
|
102
103
|
- spec/r3_plugin_toolbox/extender/extender_i18n_spec.rb
|
104
|
+
- spec/r3_plugin_toolbox/extender/extender_macro_view_spec.rb
|
103
105
|
- spec/r3_plugin_toolbox/extender_spec.rb
|
104
106
|
- spec/r3_plugin_toolbox/railtie_spec.rb
|
105
107
|
- spec/r3_plugin_toolbox/shortcuts_spec.rb
|
@@ -141,10 +143,12 @@ specification_version: 3
|
|
141
143
|
summary: Toolbox to facilitate Rails 3 plugin development
|
142
144
|
test_files:
|
143
145
|
- spec/fixtures/extension_modules.rb
|
146
|
+
- spec/r3_plugin_toolbox/engine_macro_spec.rb
|
144
147
|
- spec/r3_plugin_toolbox/engine_spec.rb
|
145
148
|
- spec/r3_plugin_toolbox/extender/extend_view_content_spec.rb
|
146
149
|
- spec/r3_plugin_toolbox/extender/extender_action_spec.rb
|
147
150
|
- spec/r3_plugin_toolbox/extender/extender_i18n_spec.rb
|
151
|
+
- spec/r3_plugin_toolbox/extender/extender_macro_view_spec.rb
|
148
152
|
- spec/r3_plugin_toolbox/extender_spec.rb
|
149
153
|
- spec/r3_plugin_toolbox/railtie_spec.rb
|
150
154
|
- spec/r3_plugin_toolbox/shortcuts_spec.rb
|