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,34 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'subclass matcher' do
|
|
4
|
-
context "content without subclass Greeting" do
|
|
5
|
-
no_subclass = %q{
|
|
6
|
-
class Hello
|
|
7
|
-
def hello
|
|
8
|
-
end
|
|
9
|
-
end}
|
|
10
|
-
|
|
11
|
-
it "should not have subclass Greeting" do
|
|
12
|
-
no_subclass.should_not have_subclass :hello, :greeting do |content|
|
|
13
|
-
puts content
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "content with subclass Greeting" do
|
|
19
|
-
with_subclass = %q{
|
|
20
|
-
class Hello < Greeting
|
|
21
|
-
def hello
|
|
22
|
-
end
|
|
23
|
-
end}
|
|
24
|
-
|
|
25
|
-
it "should not have subclass Greeting" do
|
|
26
|
-
with_subclass.should have_subclass :hello, :greeting do |content|
|
|
27
|
-
puts content
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'include module matcher' do
|
|
4
|
-
context "content without include Greeting" do
|
|
5
|
-
no_include = %q{
|
|
6
|
-
class Hello < Greeting
|
|
7
|
-
def hello
|
|
8
|
-
end
|
|
9
|
-
end}
|
|
10
|
-
|
|
11
|
-
it "should not have include Greeting" do
|
|
12
|
-
no_include.should_not include_module :greeting do |content|
|
|
13
|
-
puts content
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "content with include Greeting" do
|
|
19
|
-
with_module = %q{
|
|
20
|
-
class Hello
|
|
21
|
-
include Greeting
|
|
22
|
-
|
|
23
|
-
def hello
|
|
24
|
-
end
|
|
25
|
-
end}
|
|
26
|
-
|
|
27
|
-
it "should have include Greeting" do
|
|
28
|
-
with_module.should include_module :greeting do |content|
|
|
29
|
-
puts content
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'inherit matcher' do
|
|
4
|
-
context "content with class that inherits from Greeting" do
|
|
5
|
-
no_subclass = %q{
|
|
6
|
-
class Hello
|
|
7
|
-
def hello
|
|
8
|
-
end
|
|
9
|
-
end}
|
|
10
|
-
|
|
11
|
-
it "should not inherit from Greeting" do
|
|
12
|
-
no_subclass.should_not inherit_from :greeting do |content|
|
|
13
|
-
puts content
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "content with subclass Greeting" do
|
|
19
|
-
with_subclass = %q{
|
|
20
|
-
class Hello < Greeting
|
|
21
|
-
def hello
|
|
22
|
-
end
|
|
23
|
-
end}
|
|
24
|
-
|
|
25
|
-
it "should not inherit_from Greeting" do
|
|
26
|
-
with_subclass.should inherit_from :greeting do |content|
|
|
27
|
-
puts content
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'controller' do
|
|
4
|
-
load_helper :controller
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
create_empty_tmp :controller
|
|
8
|
-
create_controller :account do
|
|
9
|
-
%q{
|
|
10
|
-
def index
|
|
11
|
-
end
|
|
12
|
-
}
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
after :each do
|
|
17
|
-
remove_controller :account
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "should have an account_controller file that contains an AccountController class with an index method inside" do
|
|
21
|
-
Rails.application.should have_controller :account do |controller_file|
|
|
22
|
-
controller_file.should have_controller_class :account do |klass|
|
|
23
|
-
klass.should have_method :index
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'rails helper' do
|
|
4
|
-
load_helper :helper
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
create_helper :account do
|
|
8
|
-
%q{
|
|
9
|
-
def help_me
|
|
10
|
-
end
|
|
11
|
-
}
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
after :each do
|
|
16
|
-
remove_helper :account
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it "should have an account_helper file that contains an AccountHelper class with a help_me method inside" do
|
|
20
|
-
Rails.application.should have_helper :account do |file|
|
|
21
|
-
file.should have_helper_class :account do |klass|
|
|
22
|
-
klass.should have_method :help_me
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'mailer helper' do
|
|
4
|
-
load_helper :mailer
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
create_mailer :account do
|
|
8
|
-
%q{
|
|
9
|
-
def mail_it!
|
|
10
|
-
end
|
|
11
|
-
}
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
after :each do
|
|
16
|
-
remove_mailer :account
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it "should have an account mailer file with a mail_it! method inside" do
|
|
20
|
-
Rails.application.should have_mailer :account do |file|
|
|
21
|
-
file.should have_method :mail_it!
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'model helper' do
|
|
4
|
-
use_orm :active_record
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
create_model :account, :content => '# hello'
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
after :each do
|
|
11
|
-
remove_model :account
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "should have an :account model file that contains an Account class" do
|
|
15
|
-
Rails.application.should have_model :account do |file|
|
|
16
|
-
file.should have_class :account
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe 'model helper - no ORM helper' do
|
|
22
|
-
load_helper :model
|
|
23
|
-
|
|
24
|
-
before :each do
|
|
25
|
-
remove_model :account
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it "should not be able to create a model without including an ORM helper" do
|
|
29
|
-
lambda {create_model :account}.should raise_error
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'observer helper' do
|
|
4
|
-
load_helper :observer
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
create_observer :account
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
after :each do
|
|
11
|
-
remove_observer :account
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "should have an :account observer file that contains an AccountObserver class" do
|
|
15
|
-
Rails.application.should have_observer :account do |file|
|
|
16
|
-
file.should have_observer_class :account
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'rails view helper' do
|
|
4
|
-
load_helper :view
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
create_view :account, :edit do
|
|
8
|
-
%q{
|
|
9
|
-
<h1><%= title %></h1>
|
|
10
|
-
}
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
after :each do
|
|
15
|
-
remove_view :account, :edit
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "should have an account/edit view file that displays a title" do
|
|
19
|
-
Rails.application.should have_view :account, :edit do |file|
|
|
20
|
-
file.should match /<%=\s*title\s*%>/
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
File without changes
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'controller' do
|
|
4
|
-
helpers :controller
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
remove_controller :account
|
|
8
|
-
create_controller :account do
|
|
9
|
-
%q{
|
|
10
|
-
def index
|
|
11
|
-
end
|
|
12
|
-
}
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
after :each do
|
|
17
|
-
# remove_controller :account
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "should have an account_controller file that contains an index method and two inserted comments" do
|
|
21
|
-
insert_into_controller :account, :content => '# hello'
|
|
22
|
-
insert_into_controller :account do
|
|
23
|
-
'# goodbye'
|
|
24
|
-
end
|
|
25
|
-
read_controller(:account).should have_comment 'hello'
|
|
26
|
-
|
|
27
|
-
Rails.application.should have_controller :account do |controller_file|
|
|
28
|
-
controller_file.should have_method :index
|
|
29
|
-
controller_file.should have_comment 'hello'
|
|
30
|
-
controller_file.should have_comment 'goodbye'
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'helper' do
|
|
4
|
-
helpers :helper
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
remove_helper :account
|
|
8
|
-
create_helper :account do
|
|
9
|
-
%q{
|
|
10
|
-
def index
|
|
11
|
-
end
|
|
12
|
-
}
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
after :each do
|
|
17
|
-
# remove_helper :account
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "should have an account_helper file that contains an index method and two inserted comments" do
|
|
21
|
-
insert_into_helper :account, :content => '# hello'
|
|
22
|
-
insert_into_helper :account do
|
|
23
|
-
'# goodbye'
|
|
24
|
-
end
|
|
25
|
-
read_helper(:account).should have_comment 'hello'
|
|
26
|
-
|
|
27
|
-
Rails.application.should have_helper :account do |helper_file|
|
|
28
|
-
helper_file.should have_method :index
|
|
29
|
-
helper_file.should have_comment 'hello'
|
|
30
|
-
helper_file.should have_comment 'goodbye'
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'mailer' do
|
|
4
|
-
load_helper :mailer
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
remove_mailer :account
|
|
8
|
-
create_mailer :account do
|
|
9
|
-
%q{
|
|
10
|
-
def index
|
|
11
|
-
end
|
|
12
|
-
}
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
after :each do
|
|
17
|
-
# remove_mailer :account
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "should have an account_mailer file that contains an index method and two inserted comments" do
|
|
21
|
-
insert_into_mailer :account, :content => '# hello'
|
|
22
|
-
insert_into_mailer :account do
|
|
23
|
-
'# goodbye'
|
|
24
|
-
end
|
|
25
|
-
read_mailer(:account).should have_comment 'hello'
|
|
26
|
-
|
|
27
|
-
Rails.application.should have_mailer :account do |mailer_file|
|
|
28
|
-
mailer_file.should have_method :index
|
|
29
|
-
mailer_file.should have_comment 'hello'
|
|
30
|
-
mailer_file.should have_comment 'goodbye'
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
File without changes
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'model' do
|
|
4
|
-
use_orm :active_record
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
remove_model :account
|
|
8
|
-
create_model :account do
|
|
9
|
-
%q{ def index
|
|
10
|
-
end}
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
after :each do
|
|
15
|
-
# remove_model :account
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "should have an account_model file that contains an index method and two inserted comments" do
|
|
19
|
-
insert_into_model :account, :content => '# hello'
|
|
20
|
-
insert_into_model :account do
|
|
21
|
-
'# goodbye'
|
|
22
|
-
end
|
|
23
|
-
read_model(:account).should have_comment 'hello'
|
|
24
|
-
|
|
25
|
-
Rails.application.should have_model :account do |model_file|
|
|
26
|
-
model_file.should have_method :index
|
|
27
|
-
model_file.should have_comment 'hello'
|
|
28
|
-
model_file.should have_comment 'goodbye'
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'observer' do
|
|
4
|
-
load_helper :observer
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
remove_observer :account
|
|
8
|
-
create_observer :account do
|
|
9
|
-
%q{
|
|
10
|
-
def index
|
|
11
|
-
end
|
|
12
|
-
}
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
after :each do
|
|
17
|
-
# remove_observer :account
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "should have an account_observer file that contains an index method and two inserted comments" do
|
|
21
|
-
insert_into_observer :account, :content => '# hello'
|
|
22
|
-
insert_into_observer :account do
|
|
23
|
-
'# goodbye'
|
|
24
|
-
end
|
|
25
|
-
read_observer(:account).should have_comment 'hello'
|
|
26
|
-
|
|
27
|
-
Rails.application.should have_observer :account do |observer_file|
|
|
28
|
-
observer_file.should have_method :index
|
|
29
|
-
observer_file.should have_comment 'hello'
|
|
30
|
-
observer_file.should have_comment 'goodbye'
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|