generator-spec 0.5.0 → 0.6.3
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/.document +0 -0
- data/.gitignore +0 -0
- data/.rspec +0 -0
- data/LICENSE +0 -0
- data/README.markdown +19 -13
- data/Rakefile +14 -35
- data/VERSION +1 -1
- data/generator-spec.gemspec +63 -148
- data/lib/generator-spec.rb +12 -0
- data/lib/generator-spec/namespaces.rb +7 -0
- data/lib/{generator_spec/helpers/configure_rails.rb → generator-spec/rails/configure.rb} +3 -3
- data/lib/generator-spec/rspec.rb +1 -0
- data/lib/generator-spec/rspec/configure.rb +6 -0
- data/lib/{generator_spec/rspec_generator/generator_util.rb → generator-spec/rspec/generator.rb} +6 -6
- data/lib/{generator_spec/rspec_generator → generator-spec/rspec/generator}/configure.rb +0 -0
- data/lib/{generator_spec/require_generator.rb → generator-spec/rspec/generator/require.rb} +0 -0
- data/lib/{generator_spec/rspec_generator → generator-spec/rspec/generator}/routes.rb +0 -0
- data/lib/{generator_spec/rspec_generator → generator-spec/rspec/generator}/test_case.rb +0 -0
- data/lib/generator-spec/rspec/macro.rb +18 -0
- data/lib/generator-spec/rspec/matchers/generate_artifact.rb +34 -0
- data/lib/generator-spec/rspec/matchers/generate_artifacts.rb +33 -0
- data/lib/generators/controller/controller_generator.rb +15 -21
- data/lib/generators/helper/helper_generator.rb +13 -29
- data/lib/generators/migration/migration_generator.rb +6 -7
- data/lib/generators/migration/templates/create_users.erb +0 -0
- data/lib/generators/model/model_generator.rb +36 -55
- data/lib/generators/observer/observer_generator.rb +2 -0
- data/lib/generators/view/view_generator.rb +2 -0
- data/spec/generator_spec/generators/controller_gen_spec.rb +40 -0
- data/spec/generator_spec/generators/{helper_generator_spec.rb → helper_gen_spec.rb} +4 -8
- data/spec/generator_spec/generators/{migration_generator_spec.rb → migration_gen_spec.rb} +3 -8
- data/spec/generator_spec/generators/model_gen_spec.rb +36 -0
- data/spec/generator_spec/generators/{observer_generator_spec.rb → observer_gen_spec.rb} +12 -21
- data/spec/generator_spec/generators/{view_generator_spec.rb → view_gen_spec.rb} +9 -20
- data/spec/generator_spec/matchers/generate_artifact_spec.rb +36 -0
- data/spec/generator_spec/matchers/generate_artifacts_spec.rb +35 -0
- data/spec/spec_helper.rb +5 -6
- data/wiki/Custom Rails 3 Generators.textile b/data/wiki/Custom Rails 3 → Generators.textile +0 -0
- data/wiki/content_matchers.textile +0 -0
- data/wiki/file_matchers.textile +0 -0
- data/wiki/migration_matchers.textile +0 -0
- data/wiki/rails_helpers.textile +0 -0
- metadata +117 -154
- data/lib/generator_spec.rb +0 -12
- data/lib/generator_spec/extensions/core_ext.rb +0 -47
- data/lib/generator_spec/helpers/generator_helper.rb +0 -11
- data/lib/generator_spec/helpers/migration_helper.rb +0 -69
- data/lib/generator_spec/main.rb +0 -77
- data/lib/generator_spec/matchers/content/content_matcher.rb +0 -110
- data/lib/generator_spec/matchers/content/have_block.rb +0 -57
- data/lib/generator_spec/matchers/content/have_call.rb +0 -59
- data/lib/generator_spec/matchers/content/have_calls.rb +0 -60
- data/lib/generator_spec/matchers/content/have_class_self.rb +0 -40
- data/lib/generator_spec/matchers/content/have_comment.rb +0 -42
- data/lib/generator_spec/matchers/content/have_method.rb +0 -66
- data/lib/generator_spec/matchers/content/have_module.rb +0 -66
- data/lib/generator_spec/matchers/content/have_region.rb +0 -48
- data/lib/generator_spec/matchers/content/have_subclass.rb +0 -50
- data/lib/generator_spec/matchers/content/include_module.rb +0 -51
- data/lib/generator_spec/matchers/content/inherit_from.rb +0 -40
- data/lib/generator_spec/matchers/file/generate_directory.rb +0 -73
- data/lib/generator_spec/matchers/file/generate_file.rb +0 -103
- data/lib/generator_spec/matchers/file/generate_migration.rb +0 -54
- data/lib/generator_spec/matchers/file/have_file.rb +0 -115
- data/lib/generator_spec/matchers/helpers/content.rb +0 -18
- data/lib/generator_spec/matchers/helpers/file.rb +0 -26
- data/lib/generator_spec/matchers/helpers/migration.rb +0 -89
- data/lib/generator_spec/matchers/migration/have_column.rb +0 -29
- data/lib/generator_spec/matchers/migration/have_index.rb +0 -9
- data/lib/generator_spec/matchers/migration/have_table.rb +0 -18
- data/lib/generator_spec/matchers/migration/have_tbl_column.rb +0 -25
- data/lib/generator_spec/matchers/migration/have_up_down.rb +0 -15
- data/lib/generator_spec/rails_helpers/base_helper.rb +0 -171
- data/lib/generator_spec/rails_helpers/rails_app.rb +0 -166
- data/lib/generator_spec/rails_helpers/rails_controller.rb +0 -44
- data/lib/generator_spec/rails_helpers/rails_helper.rb +0 -40
- data/lib/generator_spec/rails_helpers/rails_mailer.rb +0 -39
- data/lib/generator_spec/rails_helpers/rails_migration.rb +0 -51
- data/lib/generator_spec/rails_helpers/rails_model.rb +0 -40
- data/lib/generator_spec/rails_helpers/rails_observer.rb +0 -39
- data/lib/generator_spec/rails_helpers/rails_orm.rb +0 -114
- data/lib/generator_spec/rails_helpers/rails_view.rb +0 -65
- data/rspec_for_generators.gemspec +0 -96
- data/spec/generator_spec/generators/controller_generator_spec.rb +0 -47
- data/spec/generator_spec/generators/model_generator_spec.rb +0 -41
- data/spec/generator_spec/matchers/content/class_self_spec.rb +0 -30
- data/spec/generator_spec/matchers/content/have_block_spec.rb +0 -57
- data/spec/generator_spec/matchers/content/have_call_spec.rb +0 -55
- data/spec/generator_spec/matchers/content/have_calls_spec.rb +0 -47
- data/spec/generator_spec/matchers/content/have_class_spec.rb +0 -34
- data/spec/generator_spec/matchers/content/have_method_spec.rb +0 -52
- data/spec/generator_spec/matchers/content/have_module_spec.rb +0 -34
- data/spec/generator_spec/matchers/content/have_region_spec.rb +0 -56
- data/spec/generator_spec/matchers/content/have_subclass_spec.rb +0 -34
- data/spec/generator_spec/matchers/content/include_module_spec.rb +0 -36
- data/spec/generator_spec/matchers/content/inherit_from_spec.rb +0 -34
- data/spec/generator_spec/matchers/file/directory_spec.rb +0 -0
- data/spec/generator_spec/matchers/file/file_spec.rb +0 -0
- data/spec/generator_spec/matchers/file/migration_spec.rb +0 -0
- data/spec/generator_spec/matchers/migration/have_column_spec.rb +0 -0
- data/spec/generator_spec/matchers/migration/have_index_spec.rb +0 -0
- data/spec/generator_spec/matchers/migration/have_table_spec.rb +0 -0
- data/spec/generator_spec/matchers/migration/have_tbl_column_spec.rb +0 -0
- data/spec/generator_spec/matchers/migration/have_up_down_spec.rb +0 -0
- data/spec/generator_spec/matchers/rails/controller_matcher_spec.rb +0 -27
- data/spec/generator_spec/matchers/rails/helper_matcher_spec.rb +0 -26
- data/spec/generator_spec/matchers/rails/mailer_matcher_spec.rb +0 -24
- data/spec/generator_spec/matchers/rails/model_matcher_spec.rb +0 -31
- data/spec/generator_spec/matchers/rails/observer_matcher_spec.rb +0 -19
- data/spec/generator_spec/matchers/rails/view_matcher_spec.rb +0 -23
- data/spec/generator_spec/rails_helpers/rails_app_spec.rb +0 -0
- data/spec/generator_spec/rails_helpers/rails_controller_spec.rb +0 -33
- data/spec/generator_spec/rails_helpers/rails_helper_spec.rb +0 -33
- data/spec/generator_spec/rails_helpers/rails_mailer_spec.rb +0 -33
- data/spec/generator_spec/rails_helpers/rails_migration_spec.rb +0 -0
- data/spec/generator_spec/rails_helpers/rails_model_spec.rb +0 -31
- data/spec/generator_spec/rails_helpers/rails_observer_spec.rb +0 -33
- data/spec/generator_spec/rails_helpers/rails_orm_spec.rb +0 -0
- data/spec/generator_spec/rails_helpers/rails_view_spec.rb +0 -31
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
-
require_generator :controller
|
|
3
|
-
|
|
4
|
-
module RSpec::Core
|
|
5
|
-
class ExampleGroup
|
|
6
|
-
include RSpec::Rails::Controller
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe 'helper_generator' do
|
|
11
|
-
before :each do
|
|
12
|
-
setup_generator 'controller_generator' do
|
|
13
|
-
tests ControllerGenerator
|
|
14
|
-
end
|
|
15
|
-
remove_controller 'account'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
after :each do
|
|
19
|
-
remove_controller 'account'
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "should not work without an Account controller file" do
|
|
23
|
-
with_generator do |g|
|
|
24
|
-
name = 'account'
|
|
25
|
-
g.run_generator [name]
|
|
26
|
-
g.should_not generate_controller name
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "should decorate an existing Account controller file with a 'control_me' method" do
|
|
31
|
-
with_generator do |g|
|
|
32
|
-
name = 'account'
|
|
33
|
-
create_controller name do
|
|
34
|
-
'# controller content'
|
|
35
|
-
end
|
|
36
|
-
g.run_generator [name]
|
|
37
|
-
g.should generate_controller name do |content|
|
|
38
|
-
content.should have_controller_class name do |klass|
|
|
39
|
-
klass.should have_method :control_me
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
-
require_generator :model
|
|
3
|
-
|
|
4
|
-
describe 'model_generator' do
|
|
5
|
-
include RSpec::Rails::Orm::ActiveRecord
|
|
6
|
-
|
|
7
|
-
before :each do
|
|
8
|
-
setup_generator 'model_generator' do
|
|
9
|
-
tests ModelGenerator
|
|
10
|
-
end
|
|
11
|
-
remove_model 'account'
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
after :each do
|
|
15
|
-
remove_model 'account'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "should not work without an Account model file" do
|
|
19
|
-
with_generator do |g|
|
|
20
|
-
name = 'account'
|
|
21
|
-
g.run_generator [name]
|
|
22
|
-
g.should_not generate_file name, :model
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "should decorate an existing Account model file with include Canable:Ables" do
|
|
27
|
-
with_generator do |g|
|
|
28
|
-
name = 'account'
|
|
29
|
-
create_model name
|
|
30
|
-
g.run_generator [name]
|
|
31
|
-
g.should generate_model name do |content|
|
|
32
|
-
content.should have_class name do |klass|
|
|
33
|
-
klass.should include_module 'Canable::Ables'
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'class_self matcher' do
|
|
4
|
-
context "content without class << self" do
|
|
5
|
-
not_class_self = %q{
|
|
6
|
-
def hello
|
|
7
|
-
end}
|
|
8
|
-
|
|
9
|
-
it "should not have class << self" do
|
|
10
|
-
not_class_self.should_not have_class_self
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
context "content with class << self" do
|
|
15
|
-
class_self = %q{
|
|
16
|
-
class << self
|
|
17
|
-
def hello
|
|
18
|
-
end
|
|
19
|
-
end # class self}
|
|
20
|
-
|
|
21
|
-
it "should have class << self" do
|
|
22
|
-
class_self.should have_class_self do |content|
|
|
23
|
-
puts "content: #{content}"
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'block matcher' do
|
|
4
|
-
context "content without block" do
|
|
5
|
-
not_class_self = %q{
|
|
6
|
-
def hello
|
|
7
|
-
end}
|
|
8
|
-
|
|
9
|
-
it "should not have block" do
|
|
10
|
-
not_class_self.should_not have_block :hello do |content|
|
|
11
|
-
puts content
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context "content with block: hello do" do
|
|
17
|
-
content = %q{
|
|
18
|
-
hello do
|
|
19
|
-
blip
|
|
20
|
-
end # do}
|
|
21
|
-
|
|
22
|
-
it "should have block" do
|
|
23
|
-
content.should have_block :hello do |content|
|
|
24
|
-
puts "content: #{content}"
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
context "content with block: hello :angel do" do
|
|
30
|
-
content = %q{
|
|
31
|
-
hello :angel do
|
|
32
|
-
blip
|
|
33
|
-
end # do}
|
|
34
|
-
|
|
35
|
-
it "should have block" do
|
|
36
|
-
content.should have_block :hello, :args => ':angel' do |content|
|
|
37
|
-
puts "content: #{content}"
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
context "content with block: hello :angel do |x,y|" do
|
|
43
|
-
content = %q{
|
|
44
|
-
hello :angel do |x,y|
|
|
45
|
-
blip
|
|
46
|
-
end # do}
|
|
47
|
-
|
|
48
|
-
it "should have block" do
|
|
49
|
-
content.should have_block :hello, :args => ':angel', :block_args => 'x,y' do |content|
|
|
50
|
-
puts "content: #{content}"
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'method call matcher' do
|
|
4
|
-
context "content without method call" do
|
|
5
|
-
not_call = %q{
|
|
6
|
-
def hello
|
|
7
|
-
end}
|
|
8
|
-
|
|
9
|
-
it "should not have call hello" do
|
|
10
|
-
not_call.should_not have_call :hello do |content|
|
|
11
|
-
puts content
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context "content with call hello" do
|
|
17
|
-
call = 'hello'
|
|
18
|
-
it "should have call to hello" do
|
|
19
|
-
call.should have_call :hello do |content|
|
|
20
|
-
puts "content: #{content}"
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
context "content with call hello" do
|
|
26
|
-
call = %q{
|
|
27
|
-
def hello
|
|
28
|
-
x.hello
|
|
29
|
-
end}
|
|
30
|
-
it "should have call to hello" do
|
|
31
|
-
call.should have_dot_call :hello do |content|
|
|
32
|
-
puts "content: #{content}"
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
context "class User with call role_strategy" do
|
|
37
|
-
clazz = %q{
|
|
38
|
-
class User < ActiveRecord::Base
|
|
39
|
-
include RoleModels::Generic
|
|
40
|
-
role_strategy :admin_flag
|
|
41
|
-
|
|
42
|
-
roles :admin,:user
|
|
43
|
-
|
|
44
|
-
end}
|
|
45
|
-
|
|
46
|
-
it "should have call to role_strategy with args :admin_flag" do
|
|
47
|
-
call.should have_call :role_strategy, :args => ':admin_flag' do |content|
|
|
48
|
-
puts "content: #{content}"
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'method calls matcher' do
|
|
4
|
-
context "content without calls" do
|
|
5
|
-
not_class_self = %q{
|
|
6
|
-
def x
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def y
|
|
10
|
-
end
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
it "should not have calls to x or y" do
|
|
14
|
-
not_class_self.should_not have_calls :x, :y do |content|
|
|
15
|
-
puts content
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
context "content with calls to x and y" do
|
|
21
|
-
class_self = %q{
|
|
22
|
-
def x
|
|
23
|
-
x
|
|
24
|
-
y
|
|
25
|
-
end}
|
|
26
|
-
|
|
27
|
-
it "should have calls to x and y" do
|
|
28
|
-
class_self.should have_calls :x, :y do |content|
|
|
29
|
-
puts "content: #{content}"
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
context "content with calls to x and y" do
|
|
35
|
-
class_self = %q{
|
|
36
|
-
def x
|
|
37
|
-
x(2)
|
|
38
|
-
y 3
|
|
39
|
-
end}
|
|
40
|
-
|
|
41
|
-
it "should have calls: x(2) and y 3" do
|
|
42
|
-
class_self.should have_calls :x => '2', :y => '3' do |content|
|
|
43
|
-
puts "content: #{content}"
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'module matcher' do
|
|
4
|
-
context "content without class Hello" do
|
|
5
|
-
no_class = %q{
|
|
6
|
-
module Hello
|
|
7
|
-
def hello
|
|
8
|
-
end
|
|
9
|
-
end}
|
|
10
|
-
|
|
11
|
-
it "should not have class Hello" do
|
|
12
|
-
no_class.should_not have_class :Hello do |content|
|
|
13
|
-
puts content
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "content with class Hello" do
|
|
19
|
-
with_class = %q{
|
|
20
|
-
class Hello
|
|
21
|
-
def hello
|
|
22
|
-
end
|
|
23
|
-
end}
|
|
24
|
-
|
|
25
|
-
it "should have class Hello" do
|
|
26
|
-
with_class.should have_class :Hello do |content|
|
|
27
|
-
puts content
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'method matcher' do
|
|
4
|
-
context "content without method" do
|
|
5
|
-
no_method = %q{
|
|
6
|
-
class X
|
|
7
|
-
end}
|
|
8
|
-
|
|
9
|
-
it "should not have method hello" do
|
|
10
|
-
no_method.should_not have_method :hello do |content|
|
|
11
|
-
puts content
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context "content with method hello" do
|
|
17
|
-
with_method = %q{
|
|
18
|
-
def hello
|
|
19
|
-
end}
|
|
20
|
-
it "should have method hello" do
|
|
21
|
-
with_method.should have_method :hello do |content|
|
|
22
|
-
puts "content: #{content}"
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
context "content: method hello with args (x, y)" do
|
|
28
|
-
with_method = %q{
|
|
29
|
-
def hello(x, y)
|
|
30
|
-
end}
|
|
31
|
-
it "should have method hello" do
|
|
32
|
-
with_method.should have_method :hello, :args => 'x, y' do |content|
|
|
33
|
-
puts "content: #{content}"
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
context "content: method hello with args x, y" do
|
|
39
|
-
with_method = %q{
|
|
40
|
-
def hello x, y
|
|
41
|
-
end}
|
|
42
|
-
it "should have method hello with args x, y" do
|
|
43
|
-
with_method.should have_method :hello, :args => 'x, y' do |content|
|
|
44
|
-
puts "content: #{content}"
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'module matcher' do
|
|
4
|
-
context "content without module Hello" do
|
|
5
|
-
no_module = %q{
|
|
6
|
-
class Hello
|
|
7
|
-
def hello
|
|
8
|
-
end
|
|
9
|
-
end}
|
|
10
|
-
|
|
11
|
-
it "should not have module Hello" do
|
|
12
|
-
no_module.should_not have_module :Hello do |content|
|
|
13
|
-
puts content
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "content with module Hello" do
|
|
19
|
-
with_module = %q{
|
|
20
|
-
module Hello
|
|
21
|
-
def hello
|
|
22
|
-
end
|
|
23
|
-
end}
|
|
24
|
-
|
|
25
|
-
it "should have module Hello" do
|
|
26
|
-
with_module.should have_module :Hello do |content|
|
|
27
|
-
puts content
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'region matcher' do
|
|
4
|
-
context "content with only protected region" do
|
|
5
|
-
only_protected_region = %q{
|
|
6
|
-
def hello
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
protected
|
|
10
|
-
|
|
11
|
-
def goodbye
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
it "should not have public region" do
|
|
17
|
-
only_protected_region.should_not have_region :public do |content|
|
|
18
|
-
puts content
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "should have protected region" do
|
|
23
|
-
only_protected_region.should have_region :protected do |content|
|
|
24
|
-
puts content
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
context "content with only private region" do
|
|
30
|
-
only_private_region = %q{
|
|
31
|
-
def hello
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
def goodbye
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
it "should not have public region" do
|
|
42
|
-
only_private_region.should_not have_region :public do |content|
|
|
43
|
-
puts content
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "should have private region" do
|
|
48
|
-
only_private_region.should have_region :private do |content|
|
|
49
|
-
puts content
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|