mack-active_record 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/lib/database.rb +118 -0
  2. data/lib/genosaurus_helpers.rb +40 -0
  3. data/lib/helpers/orm_helpers.rb +15 -15
  4. data/lib/mack-active_record.rb +16 -14
  5. data/lib/migration_generator/migration_generator.rb +1 -1
  6. data/lib/model_column.rb +55 -0
  7. data/lib/model_generator/manifest.yml +9 -1
  8. data/lib/model_generator/model_generator.rb +5 -1
  9. data/lib/model_generator/templates/rspec.rb.template +9 -0
  10. data/lib/scaffold_generator/manifest.yml +9 -2
  11. data/lib/scaffold_generator/scaffold_generator.rb +6 -5
  12. data/lib/scaffold_generator/templates/app/controllers/controller.rb.template +8 -7
  13. data/lib/scaffold_generator/templates/spec.rb.template +47 -0
  14. data/lib/tasks/db_create_drop_tasks.rake +39 -57
  15. data/lib/tasks/db_migration_tasks.rake +9 -74
  16. metadata +15 -45
  17. data/test/database.yml +0 -3
  18. data/test/fixtures/add_users_migration.rb.fixture +0 -9
  19. data/test/fixtures/album.rb.fixture +0 -3
  20. data/test/fixtures/album_unit_test.rb.fixture +0 -9
  21. data/test/fixtures/create_users_migration.rb.fixture +0 -12
  22. data/test/fixtures/routes.rb.fixture +0 -3
  23. data/test/fixtures/zoo.rb.fixture +0 -3
  24. data/test/fixtures/zoo_no_cols/edit.html.erb.fixture +0 -11
  25. data/test/fixtures/zoo_no_cols/index.html.erb.fixture +0 -20
  26. data/test/fixtures/zoo_no_cols/new.html.erb.fixture +0 -11
  27. data/test/fixtures/zoo_no_cols/show.html.erb.fixture +0 -6
  28. data/test/fixtures/zoo_with_cols/edit.html.erb.fixture +0 -19
  29. data/test/fixtures/zoo_with_cols/index.html.erb.fixture +0 -26
  30. data/test/fixtures/zoo_with_cols/new.html.erb.fixture +0 -19
  31. data/test/fixtures/zoo_with_cols/show.html.erb.fixture +0 -22
  32. data/test/fixtures/zoo_with_cols/zoos_controller.rb.fixture +0 -50
  33. data/test/generators/migration_generator_test.rb +0 -71
  34. data/test/generators/model_generator_test.rb +0 -37
  35. data/test/generators/scaffold_generator_test.rb +0 -61
  36. data/test/lib/user.rb +0 -3
  37. data/test/tasks/db_migration_tasks_test.rb +0 -57
  38. data/test/test_helper.rb +0 -77
@@ -2,85 +2,20 @@ require 'rake'
2
2
  namespace :db do
3
3
 
4
4
  desc "Migrate the database through scripts in db/migrations"
5
- task :migrate => "db:schema:create" do
6
- migration_files.each do |migration|
7
- require migration
8
- migration = File.basename(migration, ".rb")
9
- m_number = migration_number(migration)
10
- if m_number > @schema_info.version
11
- migration_name(migration).camelcase.constantize.up
12
- @schema_info.version += 1
13
- @schema_info.save
14
- end
15
- end # each
5
+ task :migrate => "mack:environment" do
6
+ #ActiveRecord::Migrator.up(File.join(Mack.root, "db", "migrations"))
7
+ Mack::Database::Migrator.migrate
16
8
  end # migrate
17
9
 
18
10
  desc "Rolls the schema back to the previous version. Specify the number of steps with STEP=n"
19
- task :rollback => ["db:schema:create", "db:abort_if_pending_migrations"] do
20
- migrations = migration_files.reverse
21
- (ENV["STEP"] || 1).to_i.times do |step|
22
- migration = migrations[step]
23
- require migration
24
- migration = File.basename(migration, ".rb")
25
- m_number = migration_number(migration)
26
- if m_number == @schema_info.version
27
- migration_name(migration).camelcase.constantize.down
28
- @schema_info.version -= 1
29
- @schema_info.save
30
- end
31
- end
32
-
11
+ task :rollback => ["mack:environment"] do
12
+ Mack::Database::Migrator.rollback
13
+ #ActiveRecord::Migrator.rollback(File.join(Mack.root, "db", "migrations"), (ENV["STEP"] || 1).to_i)
33
14
  end # rollback
34
-
35
- desc "Raises an error if there are pending migrations"
36
- task :abort_if_pending_migrations do
37
- migrations = migration_files.reverse
38
- return if migrations.empty?
39
- migration = migrations.first
40
- migration = File.basename(migration, ".rb")
41
- m_number = migration_number(migration)
42
- if m_number > @schema_info.version
43
- raise Mack::Errors::UnrunMigrations.new(m_number - @schema_info.version)
44
- end
45
- end
46
-
15
+
47
16
  desc "Displays the current schema version of your database"
48
- task :version => "db:schema:create" do
49
- puts "\nYour database is currently at version: #{@schema_info.version}\n"
50
- end
51
-
52
- private
53
- namespace :schema do
54
-
55
- task :create => "mack:environment" do
56
- require 'active_record/migration'
57
- class CreateSchemaInfo < ActiveRecord::Migration # :nodoc:
58
- def self.up
59
- create_table :schema_info do |t|
60
- t.column :version, :integer, :default => 0
61
- end
62
- end # up
63
- end # CreateSchemaInfo
64
- unless SchemaInfo.table_exists?
65
- CreateSchemaInfo.up
66
- SchemaInfo.create(:version => 0)
67
- end
68
- @schema_info = SchemaInfo.find(:first)
69
- end # create
70
-
71
- end # schema
72
-
73
-
74
- def migration_files
75
- Dir.glob(File.join(Mack::Configuration.root, "db", "migrations", "*.rb"))
76
- end
77
-
78
- def migration_number(migration)
79
- migration.match(/(^\d+)/).captures.last.to_i
80
- end
81
-
82
- def migration_name(migration)
83
- migration.match(/^\d+_(.+)/).captures.last
17
+ task :version => "mack:environment" do
18
+ puts "\nYour database is currently at version: #{Mack::Database::Migrator.version}\n"
84
19
  end
85
20
 
86
21
  end # db
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mack-active_record
3
- version: &id001 !ruby/object:Gem::Version
4
- version: 0.5.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -9,17 +9,9 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-21 00:00:00 -04:00
12
+ date: 2008-07-16 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: mack-orm_common
17
- version_requirement:
18
- version_requirements: !ruby/object:Gem::Requirement
19
- requirements:
20
- - - "="
21
- - *id001
22
- version:
23
15
  - !ruby/object:Gem::Dependency
24
16
  name: activerecord
25
17
  version_requirement:
@@ -30,22 +22,26 @@ dependencies:
30
22
  version: 2.0.2
31
23
  version:
32
24
  description: "mack-active_record was developed by: markbates"
33
- email:
25
+ email: mark@mackframework.com
34
26
  executables: []
35
27
 
36
28
  extensions: []
37
29
 
38
- extra_rdoc_files: []
39
-
30
+ extra_rdoc_files:
31
+ - README
40
32
  files:
33
+ - lib/database.rb
34
+ - lib/genosaurus_helpers.rb
41
35
  - lib/helpers/orm_helpers.rb
42
36
  - lib/mack-active_record.rb
43
37
  - lib/mack-active_record_tasks.rb
44
38
  - lib/migration_generator/migration_generator.rb
45
39
  - lib/migration_generator/templates/db/migrations/%=@migration_name%.rb.template
40
+ - lib/model_column.rb
46
41
  - lib/model_generator/manifest.yml
47
42
  - lib/model_generator/model_generator.rb
48
43
  - lib/model_generator/templates/model.rb.template
44
+ - lib/model_generator/templates/rspec.rb.template
49
45
  - lib/model_generator/templates/test.rb.template
50
46
  - lib/scaffold_generator/manifest.yml
51
47
  - lib/scaffold_generator/scaffold_generator.rb
@@ -54,12 +50,13 @@ files:
54
50
  - lib/scaffold_generator/templates/app/views/index.html.erb.template
55
51
  - lib/scaffold_generator/templates/app/views/new.html.erb.template
56
52
  - lib/scaffold_generator/templates/app/views/show.html.erb.template
53
+ - lib/scaffold_generator/templates/spec.rb.template
57
54
  - lib/scaffold_generator/templates/test.rb.template
58
55
  - lib/tasks/db_create_drop_tasks.rake
59
56
  - lib/tasks/db_migration_tasks.rake
60
57
  - README
61
58
  has_rdoc: true
62
- homepage:
59
+ homepage: http://www.mackframework.com
63
60
  post_install_message:
64
61
  rdoc_options: []
65
62
 
@@ -70,7 +67,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
67
  requirements:
71
68
  - - ">="
72
69
  - !ruby/object:Gem::Version
73
- version: "0"
70
+ version: 1.8.6
74
71
  version:
75
72
  required_rubygems_version: !ruby/object:Gem::Requirement
76
73
  requirements:
@@ -85,32 +82,5 @@ rubygems_version: 1.1.1
85
82
  signing_key:
86
83
  specification_version: 2
87
84
  summary: ActiveRecord ORM support for Mack
88
- test_files:
89
- - test/database.yml
90
- - test/fixtures
91
- - test/fixtures/add_users_migration.rb.fixture
92
- - test/fixtures/album.rb.fixture
93
- - test/fixtures/album_unit_test.rb.fixture
94
- - test/fixtures/create_users_migration.rb.fixture
95
- - test/fixtures/routes.rb.fixture
96
- - test/fixtures/zoo.rb.fixture
97
- - test/fixtures/zoo_no_cols
98
- - test/fixtures/zoo_no_cols/edit.html.erb.fixture
99
- - test/fixtures/zoo_no_cols/index.html.erb.fixture
100
- - test/fixtures/zoo_no_cols/new.html.erb.fixture
101
- - test/fixtures/zoo_no_cols/show.html.erb.fixture
102
- - test/fixtures/zoo_with_cols
103
- - test/fixtures/zoo_with_cols/edit.html.erb.fixture
104
- - test/fixtures/zoo_with_cols/index.html.erb.fixture
105
- - test/fixtures/zoo_with_cols/new.html.erb.fixture
106
- - test/fixtures/zoo_with_cols/show.html.erb.fixture
107
- - test/fixtures/zoo_with_cols/zoos_controller.rb.fixture
108
- - test/generators
109
- - test/generators/migration_generator_test.rb
110
- - test/generators/model_generator_test.rb
111
- - test/generators/scaffold_generator_test.rb
112
- - test/lib
113
- - test/lib/user.rb
114
- - test/tasks
115
- - test/tasks/db_migration_tasks_test.rb
116
- - test/test_helper.rb
85
+ test_files: []
86
+
data/test/database.yml DELETED
@@ -1,3 +0,0 @@
1
- test:
2
- adapter: sqlite3
3
- database: <%= File.join(Mack::Configuration.root, "mack-active_record_test.db") %>
@@ -1,9 +0,0 @@
1
- class AddUsers < ActiveRecord::Migration
2
- def self.up
3
- User.create(:username => "markbates", :email => "mark@mackframework.com")
4
- end
5
-
6
- def self.down
7
- User.delete_all
8
- end
9
- end
@@ -1,3 +0,0 @@
1
- class Album < ActiveRecord::Base
2
-
3
- end
@@ -1,9 +0,0 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
2
-
3
- class AlbumTest < Test::Unit::TestCase
4
-
5
- def test_truth
6
- assert true
7
- end
8
-
9
- end
@@ -1,12 +0,0 @@
1
- class CreateUsers < ActiveRecord::Migration
2
- def self.up
3
- create_table :users do |t|
4
- t.column :username, :string
5
- t.column :email, :string
6
- end
7
- end
8
-
9
- def self.down
10
- drop_table :users
11
- end
12
- end
@@ -1,3 +0,0 @@
1
- Mack::Routes.build do |r|
2
-
3
- end
@@ -1,3 +0,0 @@
1
- class Zoo < ActiveRecord::Base
2
-
3
- end
@@ -1,11 +0,0 @@
1
- <h1>Edit Zoo</h1>
2
-
3
- <%= error_messages_for :zoo %>
4
-
5
- <% form(zoos_update_url(:id => @zoo.id), :class => "edit_zoo", :id => "edit_zoo", :method => :put) do %>
6
- <p>
7
- <input id="zoo_submit" name="commit" type="submit" value="Update" />
8
- </p>
9
- <% end %>
10
-
11
- <%= link_to("Back", zoos_index_url) %>
@@ -1,20 +0,0 @@
1
- <h1>Listing Zoos</h1>
2
-
3
- <table>
4
- <tr>
5
- <th>&nbsp;</th>
6
- </tr>
7
-
8
- <% for zoo in @zoos %>
9
- <tr>
10
- <td>&nbsp;</td>
11
- <td><%= link_to("Show", zoos_show_url(:id => zoo.id)) %></td>
12
- <td><%= link_to("Edit", zoos_edit_url(:id => zoo.id)) %></td>
13
- <td><%= link_to("Delete", zoos_delete_url(:id => zoo.id), :method => :delete, :confirm => "Are you sure?") %></td>
14
- </tr>
15
- <% end %>
16
- </table>
17
-
18
- <br />
19
-
20
- <%= link_to("New Zoo", zoos_new_url) %>
@@ -1,11 +0,0 @@
1
- <h1>New Zoo</h1>
2
-
3
- <%= error_messages_for :zoo %>
4
-
5
- <% form(zoos_create_url, :class => "new_zoo", :id => "new_zoo") do %>
6
- <p>
7
- <input id="zoo_submit" name="commit" type="submit" value="Create" />
8
- </p>
9
- <% end %>
10
-
11
- <%= link_to("Back", zoos_index_url) %>
@@ -1,6 +0,0 @@
1
- <p>
2
- <h1>Zoo</h1>
3
- </p>
4
-
5
- <%= link_to("Edit", zoos_edit_url(:id => @zoo.id)) %> |
6
- <%= link_to("Back", zoos_index_url) %>
@@ -1,19 +0,0 @@
1
- <h1>Edit Zoo</h1>
2
-
3
- <%= error_messages_for :zoo %>
4
-
5
- <% form(zoos_update_url(:id => @zoo.id), :class => "edit_zoo", :id => "edit_zoo", :method => :put) do %>
6
- <p>
7
- <b>Name</b><br />
8
- <input type="text" name="zoo[name]" id="zoo_name" size="30" value="<%= @zoo.name %>" />
9
- </p>
10
- <p>
11
- <b>Description</b><br />
12
- <textarea name="zoo[description]" id="zoo_description" cols="60" rows="20"><%= @zoo.description %></textarea>
13
- </p>
14
- <p>
15
- <input id="zoo_submit" name="commit" type="submit" value="Update" />
16
- </p>
17
- <% end %>
18
-
19
- <%= link_to("Back", zoos_index_url) %>
@@ -1,26 +0,0 @@
1
- <h1>Listing Zoos</h1>
2
-
3
- <table>
4
- <tr>
5
- <th>Name</th>
6
- <th>Description</th>
7
- <th>CreatedAt</th>
8
- <th>UpdatedAt</th>
9
- </tr>
10
-
11
- <% for zoo in @zoos %>
12
- <tr>
13
- <td><%= zoo.name %></td>
14
- <td><%= zoo.description %></td>
15
- <td><%= zoo.created_at %></td>
16
- <td><%= zoo.updated_at %></td>
17
- <td><%= link_to("Show", zoos_show_url(:id => zoo.id)) %></td>
18
- <td><%= link_to("Edit", zoos_edit_url(:id => zoo.id)) %></td>
19
- <td><%= link_to("Delete", zoos_delete_url(:id => zoo.id), :method => :delete, :confirm => "Are you sure?") %></td>
20
- </tr>
21
- <% end %>
22
- </table>
23
-
24
- <br />
25
-
26
- <%= link_to("New Zoo", zoos_new_url) %>
@@ -1,19 +0,0 @@
1
- <h1>New Zoo</h1>
2
-
3
- <%= error_messages_for :zoo %>
4
-
5
- <% form(zoos_create_url, :class => "new_zoo", :id => "new_zoo") do %>
6
- <p>
7
- <b>Name</b><br />
8
- <input type="text" name="zoo[name]" id="zoo_name" size="30" value="<%= @zoo.name %>" />
9
- </p>
10
- <p>
11
- <b>Description</b><br />
12
- <textarea name="zoo[description]" id="zoo_description" cols="60" rows="20"><%= @zoo.description %></textarea>
13
- </p>
14
- <p>
15
- <input id="zoo_submit" name="commit" type="submit" value="Create" />
16
- </p>
17
- <% end %>
18
-
19
- <%= link_to("Back", zoos_index_url) %>
@@ -1,22 +0,0 @@
1
- <p>
2
- <h1>Zoo</h1>
3
- </p>
4
- <p>
5
- <b>Name</b><br />
6
- <%= @zoo.name %>
7
- </p>
8
- <p>
9
- <b>Description</b><br />
10
- <%= @zoo.description %>
11
- </p>
12
- <p>
13
- <b>CreatedAt</b><br />
14
- <%= @zoo.created_at %>
15
- </p>
16
- <p>
17
- <b>UpdatedAt</b><br />
18
- <%= @zoo.updated_at %>
19
- </p>
20
-
21
- <%= link_to("Edit", zoos_edit_url(:id => @zoo.id)) %> |
22
- <%= link_to("Back", zoos_index_url) %>
@@ -1,50 +0,0 @@
1
- class ZoosController < Mack::Controller::Base
2
-
3
- # GET /zoos
4
- def index
5
- @zoos = Zoo.find(:all)
6
- end
7
-
8
- # GET /zoos/1
9
- def show
10
- @zoo = Zoo.find(params(:id))
11
- end
12
-
13
- # GET /zoos/new
14
- def new
15
- @zoo = Zoo.new
16
- end
17
-
18
- # GET /zoos/1/edit
19
- def edit
20
- @zoo = Zoo.find(params(:id))
21
- end
22
-
23
- # POST /zoos
24
- def create
25
- @zoo = Zoo.new(params(:zoo))
26
- if @zoo.save
27
- redirect_to(zoos_show_url(:id => @zoo.id))
28
- else
29
- render(:action, "new")
30
- end
31
- end
32
-
33
- # PUT /zoos/1
34
- def update
35
- @zoo = Zoo.find(params(:id))
36
- if @zoo.update_attributes(params(:zoo))
37
- redirect_to(zoos_show_url(:id => @zoo.id))
38
- else
39
- render(:action, "edit")
40
- end
41
- end
42
-
43
- # DELETE /zoos/1
44
- def delete
45
- @zoo = Zoo.find(params(:id))
46
- @zoo.destroy
47
- redirect_to(zoos_index_url)
48
- end
49
-
50
- end
@@ -1,71 +0,0 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
2
-
3
- class MigrationGeneratorTest < Test::Unit::TestCase
4
-
5
- def test_next_migration_number
6
- mg = MigrationGenerator.new("NAME" => "foo")
7
- assert_equal "001", mg.next_migration_number
8
- FileUtils.mkdir_p(migrations_directory)
9
- assert File.exists?(migrations_directory)
10
- File.open(File.join(migrations_directory, "001_foo.rb"), "w") {|f| f.puts ""}
11
- assert_equal "002", mg.next_migration_number
12
- end
13
-
14
- def test_generate_data_mapper
15
- generate_common
16
- mig = <<-MIG
17
- class FooBar < ActiveRecord::Migration
18
-
19
- def self.up
20
- end
21
-
22
- def self.down
23
- end
24
-
25
- end
26
- MIG
27
- assert_equal mig, @file_body
28
- end
29
-
30
- def test_generate_data_mapper_with_columns
31
- generate_common({"NAME" => "create_users", "cols" => "username:string,email_address:string,created_at:datetime,updated_at:datetime"})
32
- mig = <<-MIG
33
- class CreateUsers < ActiveRecord::Migration
34
-
35
- def self.up
36
- create_table :users do |t|
37
- t.column :username, :string
38
- t.column :email_address, :string
39
- t.column :created_at, :datetime
40
- t.column :updated_at, :datetime
41
- end
42
- end
43
-
44
- def self.down
45
- drop_table :users
46
- end
47
-
48
- end
49
- MIG
50
- assert_equal mig, @file_body
51
- end
52
-
53
- def generate_common(opts = {})
54
- 5.times do |i|
55
- options = {"NAME" => "foo_bar"}.merge(opts)
56
- mg = MigrationGenerator.run(options)
57
- assert File.exists?(migrations_directory)
58
- assert File.exists?(File.join(migrations_directory, "00#{i+1}_#{options["NAME"]}.rb"))
59
- File.open(File.join(migrations_directory, "00#{i+1}_#{options["NAME"]}.rb"), "r") do |file|
60
- @file_body = file.read
61
- end
62
- end
63
- end
64
-
65
- def test_required_params
66
- assert_raise(ArgumentError) { MigrationGenerator.new }
67
- mg = MigrationGenerator.new("NAME" => "foo")
68
- assert_not_nil mg
69
- end
70
-
71
- end
@@ -1,37 +0,0 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
2
-
3
- class ModelGeneratorTest < Test::Unit::TestCase
4
-
5
- def test_generate_data_mapper
6
- ModelGenerator.new("name" => "album").generate
7
- assert File.exists?(model_loc)
8
- assert_equal fixture("album.rb"), File.open(model_loc).read
9
- assert File.exists?(migration_loc)
10
- end
11
-
12
- def test_generate_data_mapper_with_columns
13
- ModelGenerator.new("name" => "albums", "cols" => "title:string,artist_id:integer,description:text").generate
14
- assert File.exists?(model_loc)
15
- assert_equal fixture("album.rb"), File.open(model_loc).read
16
- assert File.exists?(migration_loc)
17
- end
18
-
19
- def test_unit_test_created
20
- ModelGenerator.new("name" => "album").generate
21
- assert File.exists?(unit_test_loc)
22
- assert_equal fixture("album_unit_test.rb"), File.open(unit_test_loc).read
23
- end
24
-
25
- def unit_test_loc
26
- File.join(test_directory, "unit", "album_test.rb")
27
- end
28
-
29
- def model_loc
30
- File.join(models_directory, "album.rb")
31
- end
32
-
33
- def migration_loc
34
- File.join(migrations_directory, "001_create_albums.rb")
35
- end
36
-
37
- end
@@ -1,61 +0,0 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
2
-
3
- class ScaffoldGeneratorTest < Test::Unit::TestCase
4
-
5
- def test_generate_data_mapper
6
- sg = ScaffoldGenerator.run("name" => "zoo")
7
- File.open(File.join(Mack::Configuration.config_directory, "routes.rb")) do |f|
8
- assert_match "r.resource :zoos # Added by rake generate:scaffold name=zoo", f.read
9
- end
10
-
11
- assert File.exists?(views_directory)
12
- assert_equal fixture("zoo_no_cols", "edit.html.erb"), File.open(File.join(views_directory, "edit.html.erb")).read
13
- assert_equal fixture("zoo_no_cols", "index.html.erb"), File.open(File.join(views_directory, "index.html.erb")).read
14
- assert_equal fixture("zoo_no_cols", "new.html.erb"), File.open(File.join(views_directory, "new.html.erb")).read
15
- assert_equal fixture("zoo_no_cols", "show.html.erb"), File.open(File.join(views_directory, "show.html.erb")).read
16
-
17
- assert File.exists?(model_file)
18
- assert File.exists?(controller_file)
19
- assert File.exists?(migration_file)
20
- assert File.exists?(functional_test_file)
21
- assert_equal fixture("zoo_with_cols", "zoos_controller.rb"), File.open(controller_file).read
22
- assert_equal fixture("zoo.rb"), File.open(model_file).read
23
- end
24
-
25
- def test_generate_data_mapper_with_columns
26
- sg = ScaffoldGenerator.run("name" => "zoo", "cols" => "name:string,description:text,created_at:datetime,updated_at:datetime")
27
- File.open(File.join(Mack::Configuration.config_directory, "routes.rb")) do |f|
28
- assert_match "r.resource :zoos # Added by rake generate:scaffold name=zoo", f.read
29
- end
30
- assert File.exists?(views_directory)
31
- assert_equal fixture("zoo_with_cols", "edit.html.erb"), File.open(File.join(views_directory, "edit.html.erb")).read
32
- assert_equal fixture("zoo_with_cols", "index.html.erb"), File.open(File.join(views_directory, "index.html.erb")).read
33
- assert_equal fixture("zoo_with_cols", "new.html.erb"), File.open(File.join(views_directory, "new.html.erb")).read
34
- assert_equal fixture("zoo_with_cols", "show.html.erb"), File.open(File.join(views_directory, "show.html.erb")).read
35
-
36
- assert File.exists?(model_file)
37
- assert File.exists?(controller_file)
38
- assert File.exists?(migration_file)
39
- end
40
-
41
- def functional_test_file
42
- File.join(test_directory, "functional", "zoos_controller_test.rb")
43
- end
44
-
45
- def views_directory
46
- File.join(Mack::Configuration.views_directory, "zoos")
47
- end
48
-
49
- def model_file
50
- File.join(Mack::Configuration.app_directory, "models", "zoo.rb")
51
- end
52
-
53
- def controller_file
54
- File.join(Mack::Configuration.app_directory, "controllers", "zoos_controller.rb")
55
- end
56
-
57
- def migration_file
58
- File.join(migrations_directory, "001_create_zoos.rb")
59
- end
60
-
61
- end
data/test/lib/user.rb DELETED
@@ -1,3 +0,0 @@
1
- class User < ActiveRecord::Base
2
-
3
- end