rails3_assist 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,12 +35,24 @@ The ORM used is specified by calling <code>use_orm :[orm]</code> fx <code>use_or
35
35
 
36
36
  ### Usage
37
37
 
38
- Generators are often designed to create Rails 3 artifacts or update existing artifacts. It's often useful to include one or more Rails 3 artifact assisters along
39
- with a generator assister (see above).
40
- This combination greatly facilitates your work in developing the generator, as much of the heavy lifting will be done for you in the assisters.
41
- To use a helper, simply call:
38
+ Set the root if not already set, then use the special assist/use methods to draw in the modules with all the goodies!
42
39
 
43
- *assist_with [list of helpers]*
40
+ ### Rails root
41
+
42
+ You have to set the class variable <code>Rails::Assist::App.rails_root_dir</code> to the location of your Rails root directory if you are using this gem outside of Rails,
43
+ Fx for testing purposes or something. It will default to use <code>Rails.root</code> if this class variable is not set to override it.
44
+
45
+ In the specs I use the *rails_root_dir* class variable to avoid having to set a Rails app specific variable, which I deemed unnecessary for most of the tests.
46
+
47
+ ### Artifact assistants
48
+
49
+ Generators are often designed to create Rails 3 artifacts or update existing artifacts. It's often useful to include one or more Rails 3 artifact assistants along
50
+ with a generator assistant (see above).
51
+
52
+ This combination greatly facilitates your work in developing the generator, as much of the heavy lifting will be done for you in the assistants.
53
+ To use a specific assistant/helper, simply call:
54
+
55
+ *assist_with [list of assistant symbols]*
44
56
 
45
57
  Example:
46
58
 
@@ -48,6 +60,11 @@ Example:
48
60
 
49
61
  Aliases: *use_helpers* and *use_helper*
50
62
 
63
+ ## Known issues
64
+
65
+ * View generation fails when action arg supplied :( To be fixed ASAP
66
+ - rails3_assist/artifact/view.rb:7:in `[]' can't convert Symbol into Integer
67
+
51
68
  ## Note on Patches/Pull Requests
52
69
 
53
70
  * Fork the project.
data/Rakefile CHANGED
@@ -7,11 +7,14 @@ begin
7
7
  gem.email = "kmandrup@gmail.com"
8
8
  gem.homepage = "http://github.com/kristianmandrup/rails3-assist"
9
9
  gem.authors = ["Kristian Mandrup"]
10
- gem.add_development_dependency "rspec", ">= 2.0.0.beta.19"
11
- # gem.add_development_dependency "generator-rspec", ">= 0.6.0"
10
+ gem.add_development_dependency "rspec", ">= 2.0.0.beta.19"
11
+ gem.add_development_dependency 'rails-app-spec', '>= 0.2.2'
12
+
12
13
  gem.add_dependency "require_all", ">= 1.1.0"
13
14
  gem.add_dependency "migration_assist", ">= 0.1.2"
14
15
 
16
+ # gem.add_development_dependency "generator-rspec", ">= 0.6.0"
17
+
15
18
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
19
  end
17
20
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -4,8 +4,8 @@ module Rails::Assist
4
4
  end
5
5
 
6
6
  module ArtifactPath
7
- def artifact_path name, type, dir=nil
8
- dir ||= send :"#{type}_dir"
7
+ def artifact_path name, type, options={}
8
+ dir = send :"#{type}_dir", options[:root_path]
9
9
  File.join(dir, "#{name}#{type_postfix type}.rb")
10
10
  end
11
11
 
@@ -39,7 +39,7 @@ module Rails::Assist::App
39
39
  include RailsDirs
40
40
 
41
41
  # put all FileName modules into App
42
- Rails::Assist.artifacts.each do |name|
42
+ Rails::Assist.helper_list.each do |name|
43
43
  class_eval %{
44
44
  include Rails::Assist::#{name.to_s.camelize}::FileName
45
45
  }
@@ -1,20 +1,83 @@
1
+ require 'migration_assist'
2
+
1
3
  module Rails::Assist
2
4
  module View
3
- module FileName
4
- def view_file_name folder, action=nil, type=nil
5
- File.join(view_dir, folder.to_s, "#{get_action action}.#{get_type type}")
6
- end
7
- end
5
+ module FileName
6
+ DEFAULT_TEMPLATE_LANG = 'html.erb'
7
+ DEFAULT_REST_ACTION = 'show'
8
+
9
+ def view_file_name folder, *args
10
+ action, type, args = get_view_args(args)
11
+ File.expand_path File.join(view_dir, folder.to_s, "#{action}.#{type}")
12
+ end
13
+
14
+ def get_view_args args
15
+ args = args.flatten
16
+ action = DEFAULT_REST_ACTION
17
+ type = DEFAULT_TEMPLATE_LANG
18
+ case args.first
19
+ when Hash
20
+ action = args.first.delete(:action)
21
+ type = args.first.delete(:type)
22
+ when String, Symbol
23
+ action = args.delete_at(0)
24
+ end
25
+ case args.first
26
+ when String, Symbol
27
+ type = args.delete_at(0)
28
+ end
29
+ [action, type, args]
30
+ end
31
+ end
32
+
33
+ include FileName
8
34
  end
9
35
 
10
36
  module Migration
11
- module FileName
37
+ module FileName
38
+ include Rails::Migration::Assist::ClassMethods
39
+
40
+ class FindError
41
+ attr_accessor :find_expr
42
+
43
+ def initialize find_expr
44
+ self.find_expr = find_expr
45
+ end
46
+ end
47
+
12
48
  def migration_file_name name, options={}
13
49
  number = options[:number]
14
- number = next_migration_number(migration_dir) if !number
50
+
51
+ migration_dir_name = File.expand_path(migration_dir options[:root_path])
52
+
53
+ number = next_migration_number(migration_dir_name) if !number
15
54
  File.join(migration_dir, "#{number}_#{name}.rb")
16
55
  end
56
+
57
+ def find_migration name, options={}
58
+ root_path = options[:root_path]
59
+
60
+ migration_dir_name = File.expand_path(migration_dir options[:root_path])
61
+
62
+ migration_find_expr = "#{migration_dir_name}/[0-9]*_*.rb"
63
+ migrations = Dir.glob(migration_find_expr)
64
+
65
+ find_err = FindError.new migration_find_expr
66
+
67
+ return find_err if migrations.empty?
68
+
69
+ migration_find_expr = /\d+_#{name}\.rb$/
70
+ find_err.find_expr = migration_find_expr
71
+
72
+ matching_migrations = migrations.grep(migration_find_expr)
73
+
74
+ return find_err if matching_migrations.empty?
75
+
76
+ migration_file = (options[:last]) ? matching_migrations.last : matching_migrations.first
77
+ end
17
78
  end
79
+
80
+ include FileName
18
81
  end
19
82
 
20
83
  (Rails::Assist.artifacts. - [:migration, :view]).each do |name|
@@ -23,7 +86,7 @@ module Rails::Assist
23
86
  module FileName
24
87
 
25
88
  def #{name}_file_name name, options=nil
26
- artifact_path name, :#{name}
89
+ artifact_path name, :#{name}, options
27
90
  end
28
91
  end
29
92
 
@@ -1,5 +1,5 @@
1
1
  module Rails::Assist
2
- (artifacts - [:migration, :model]).each do |name|
2
+ (artifacts - [:model]).each do |name|
3
3
  class_eval %{
4
4
  module #{name.to_s.camelize}
5
5
  def new_#{name}_content name, content=nil, &block
@@ -37,68 +37,69 @@ module Rails::Assist
37
37
  rails_containers.include?(type)
38
38
  end
39
39
 
40
- def root_dir
41
- dir = Rails::Assist::App.rails_root_dir
40
+ def root_dir options={}
41
+ dir = options[:root_path] if options
42
+ dir ||= Rails::Assist::App.rails_root_dir || Rails.root
42
43
  raise "You must set the Rails app root dir: Rails::Assist::App.root_dir = '/my/root/dir'" if !dir
43
44
  dir
44
45
  end
45
46
 
46
- def rails_dir_for type
47
+ def rails_dir_for type, options={}
47
48
  raise ArgumentError, '#rails_dir_for takes a dir type argument' if !type
48
49
  dir_method = "#{type}_dir"
49
- self.send(dir_method) if respond_to?(dir_method)
50
+ self.send(dir_method, options) if respond_to?(dir_method)
50
51
  end
51
52
 
52
- def migration_dir
53
- File.join(db_dir, 'migrations')
53
+ def migration_dir options={}
54
+ File.join(db_dir(options), 'migrations')
54
55
  end
55
56
 
56
- def config_dir_for type
57
- File.join(config_dir, type.to_s)
57
+ def config_dir_for type, options={}
58
+ File.join(config_dir(options), type.to_s)
58
59
  end
59
60
 
60
- def initializer_dir
61
- config_dir_for type :initializers
61
+ def initializer_dir options={}
62
+ config_dir_for type :initializers, options
62
63
  end
63
64
 
64
- def locale_dir
65
- config_dir_for type :locales
65
+ def locale_dir options={}
66
+ config_dir_for type :locales, options
66
67
  end
67
68
 
68
- def public_dir_for type
69
- File.join(public_dir, type.to_s)
69
+ def public_dir_for type, options={}
70
+ File.join(public_dir(options), type.to_s)
70
71
  end
71
72
 
72
- def stylesheet_dir
73
- public_dir_for :stylesheets
73
+ def stylesheet_dir options={}
74
+ public_dir_for :stylesheets, options
74
75
  end
75
76
 
76
- def javascript_dir
77
- public_dir_for :javascripts
77
+ def javascript_dir options={}
78
+ public_dir_for :javascripts, options
78
79
  end
79
80
 
80
81
  root_directories.each do |name|
81
82
  class_eval %{
82
- def #{name}_dir
83
- File.join(root_dir, '#{name}')
83
+ def #{name}_dir options={}
84
+ File.join(root_dir(options), '#{name}')
84
85
  end
85
86
  }
86
87
  end
87
88
 
88
89
  app_artifacts.each do |name|
89
90
  class_eval %{
90
- def #{name}_dir
91
- File.join(app_dir, '#{name}')
91
+ def #{name}_dir options={}
92
+ File.join(app_dir(options), '#{name}')
92
93
  end
93
94
  }
94
95
  end
95
96
 
96
- def app_dir
97
- File.join(root_dir, 'app')
97
+ def app_dir options={}
98
+ File.join(root_dir(options), 'app')
98
99
  end
99
100
 
100
- def observer_dir
101
- model_dir
101
+ def observer_dir options={}
102
+ model_dir options
102
103
  end
103
104
  end # RailsDirs
104
105
  end # App
@@ -22,6 +22,12 @@ module Rails::Assist
22
22
  "#{name.to_s.camelize}Observer < ActiveRecord::Observer"
23
23
  end
24
24
  end
25
+
26
+ module Migration
27
+ def migration_marker name, options=nil
28
+ "#{name.to_s.camelize} < ActiveRecord::Migration"
29
+ end
30
+ end
25
31
 
26
32
  module Model
27
33
  include Rails::Assist::BaseHelper
@@ -6,19 +6,5 @@ module Rails::Assist
6
6
  module Migration
7
7
  include Rails::Assist::BaseHelper
8
8
  include Rails::Migration::Assist::ClassMethods
9
-
10
- include FileName
11
-
12
- def find_migration name, option=nil
13
- migrations = Dir.glob("#{migration_dir}/[0-9]*_*.rb")
14
- return nil if !migrations.empty?
15
- matching_migrations = migrations.grep(/\d+_#{name}\.rb$/)
16
- return nil if matching_migrations.empty?
17
- migration_file = (option == :last) ? matching_migrations.last : matching_migrations.first
18
- end
19
-
20
- def migration_marker name, options=nil
21
- "#{name.to_s.camelize} < ActiveRecord::Migration"
22
- end
23
9
  end
24
10
  end
@@ -3,26 +3,27 @@ module Rails::Assist
3
3
  include Rails::Assist::BaseHelper
4
4
 
5
5
  # CREATE
6
- def create_view name, options = {}, &block
7
- file = view_file_name(name, options[:action], options[:type])
8
- dir = File.dirname(file)
6
+ def create_view name, *args, &block
7
+ file_name = view_file_name(name, args)
8
+ dir = File.dirname(file_name)
9
9
  FileUtils.mkdir_p dir if !File.directory?(dir)
10
- content = options[:content]
11
- # set content to block
12
- content ||= yield if block
13
10
 
14
- # abort if no content given
15
- return if !content
11
+ content = get_content(args) || yield if block
16
12
 
13
+ # abort if no content given
14
+ debug "Warning: Content must be passed in either as a :content hash or a block" if !content
15
+ return nil if !content
16
+
17
+ debug "Writing view file: #{file_name}"
17
18
  # write file content of view
18
- File.open(file, 'w') do |f|
19
+ File.open(file_name, 'w') do |f|
19
20
  f.puts content
20
21
  end
21
22
  end
22
23
 
23
24
  # READ
24
- def read_view(name, options = {}, &block)
25
- file_name = view_file_name(name, options[:action], options[:type])
25
+ def read_view(name, *args, &block)
26
+ file_name = view_file_name(name, args)
26
27
  debug "reading from: #{file_name}"
27
28
  file = File.new(file_name)
28
29
  raise "The view file: #{file} could not be found" if !file
@@ -36,14 +37,18 @@ module Rails::Assist
36
37
  end
37
38
  end
38
39
 
39
-
40
40
  # UPDATE
41
- def insert_into_view(name, options = {}, &block)
42
- debug "insert_into_view: #{options}"
43
- file = view_file_name(name, options[:action], options[:type])
44
- debug "file insertion (view): #{file}"
41
+ def insert_into_view(name, *args, &block)
42
+ arguments = args.clone
43
+ action, type, args = get_view_args(args)
44
+ file_name = view_file_name(name, arguments)
45
+ debug "file insertion (view): #{file_name}"
46
+
47
+ options = args.first.kind_of?(Hash) ? args.first : {}
45
48
  marker = options[:before] || options[:after]
46
- file_insertion(file, marker, options, &block) if marker
49
+
50
+ raise ArgumentError, ":before or :after option must be specified for insertion" if !marker
51
+ file_insertion(file_name, marker, options, &block)
47
52
  end
48
53
 
49
54
  # DELETE
@@ -52,15 +57,13 @@ module Rails::Assist
52
57
  FileUtils.rm_f(file) if File.exist?(file)
53
58
  end
54
59
 
55
- def get_action action
56
- action || 'show'
57
- end
58
-
59
- def get_type type
60
- type || 'html.erb'
61
- end
62
-
63
- include FileName
60
+ def get_content args
61
+ args = args.flatten
62
+ case args.first
63
+ when Hash
64
+ args.first[:content]
65
+ end
66
+ end
64
67
 
65
68
  aliases_for :view
66
69
  end
@@ -14,7 +14,7 @@ module Rails::Assist
14
14
  case options
15
15
  when Hash
16
16
  raise ArgumentError, "No artifact type specified #{options}" if !options[:type]
17
- options[:type]
17
+ options[:type].to_sym
18
18
  when String, Symbol
19
19
  options.to_sym
20
20
  else
@@ -1,17 +1,40 @@
1
1
  module Rails::Assist
2
- module BaseHelper
3
- include Rails::Assist::ArtifactPath
2
+ module BaseHelper
3
+ module FileName
4
+ include Rails::Assist::ArtifactPath
4
5
 
5
- def make_file_name name, type, options={}
6
- send :"#{type}_file_name", name, options
7
- end
6
+ def make_file_name name, type, options={}
7
+ send :"#{type}_file_name", name, options
8
+ end
8
9
 
9
- def existing_file_name name, type
10
- # first try finder method
11
- finder_method = :"find_#{type}"
12
- found = send finder_method, name if respond_to? finder_method
13
- # default
14
- make_file_name(name, type) if !found
15
- end
16
- end
10
+ def existing_file_name name, type=nil
11
+ # first try finder method
12
+ finder_method = :"find_#{type}"
13
+ if respond_to?(finder_method)
14
+ result = send finder_method, name
15
+ if !result.kind_of? String
16
+ raise "The call to #find_#{type}(#{name}) didn't find an existing #{type} file. Error in find expression: #{result.find_expr}"
17
+ end
18
+ return result
19
+ else
20
+ raise "The method #find_#{type} to find the migration is not available!" if type == :migration
21
+ end
22
+
23
+ # puts "Using method #make_file_name(#{name}) for #{type || 'unknown'}"
24
+
25
+ # default for non-migration
26
+ make_file_name(name, type)
27
+ end
28
+
29
+ Rails::Assist.artifacts.each do |name|
30
+ class_eval %{
31
+ def existing_#{name}_file name, type=nil
32
+ existing_file_name name, type
33
+ end
34
+ }
35
+ end
36
+ end # file_name
37
+
38
+ include FileName
39
+ end
17
40
  end
@@ -3,8 +3,12 @@ module Rails::Assist
3
3
  # UPDATE
4
4
  def insert_content(name, options={}, &block)
5
5
  type = get_type(options)
6
- file = existing_file_name(name, type)
6
+ file = existing_file_name(name, type)
7
+ raise "No file could be determined: #{file} from name: #{name} of type: #{type}" if !file
8
+ raise "File to insert in not found: #{file} for #{type}" if !File.file?(file)
9
+
7
10
  x_marker = marker(name, type, options)
11
+
8
12
  res = file_insertion file, x_marker, options, &block
9
13
  if !res
10
14
  # try with :embedded option if default doesn't work
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rails3_assist}
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
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"]
12
- s.date = %q{2010-08-19}
12
+ s.date = %q{2010-09-04}
13
13
  s.description = %q{Assist in operating on Rails 3 artifacts including migrations}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -46,6 +46,10 @@ Gem::Specification.new do |s|
46
46
  "lib/rails3_assist/rspec/macro.rb",
47
47
  "rails3_assist.gemspec",
48
48
  "rails_generator.log",
49
+ "spec/fixtures/log/development.log",
50
+ "spec/fixtures/log/production.log",
51
+ "spec/fixtures/log/server.log",
52
+ "spec/fixtures/log/test.log",
49
53
  "spec/load_spec.rb",
50
54
  "spec/rails3_assist/app/app_dirs_spec.rb",
51
55
  "spec/rails3_assist/app/app_file_names_spec.rb",
@@ -59,7 +63,8 @@ Gem::Specification.new do |s|
59
63
  "spec/rails3_assist/artifact/orm/active_record_spec.rb",
60
64
  "spec/rails3_assist/artifact/orm/mongo_mapper_spec.rb",
61
65
  "spec/rails3_assist/artifact/orm/mongoid_spec.rb",
62
- "spec/rails3_assist/artifact/view_spec/view_spec.rb",
66
+ "spec/rails3_assist/artifact/view_spec/view_controller_action_spec.rb",
67
+ "spec/rails3_assist/artifact/view_spec/view_controller_default_action_specc.rb",
63
68
  "spec/spec_helper.rb"
64
69
  ]
65
70
  s.homepage = %q{http://github.com/kristianmandrup/rails3-assist}
@@ -81,7 +86,8 @@ Gem::Specification.new do |s|
81
86
  "spec/rails3_assist/artifact/orm/active_record_spec.rb",
82
87
  "spec/rails3_assist/artifact/orm/mongo_mapper_spec.rb",
83
88
  "spec/rails3_assist/artifact/orm/mongoid_spec.rb",
84
- "spec/rails3_assist/artifact/view_spec/view_spec.rb",
89
+ "spec/rails3_assist/artifact/view_spec/view_controller_action_spec.rb",
90
+ "spec/rails3_assist/artifact/view_spec/view_controller_default_action_specc.rb",
85
91
  "spec/spec_helper.rb"
86
92
  ]
87
93
 
@@ -91,15 +97,18 @@ Gem::Specification.new do |s|
91
97
 
92
98
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
93
99
  s.add_development_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
100
+ s.add_development_dependency(%q<rails-app-spec>, [">= 0.2.2"])
94
101
  s.add_runtime_dependency(%q<require_all>, [">= 1.1.0"])
95
102
  s.add_runtime_dependency(%q<migration_assist>, [">= 0.1.2"])
96
103
  else
97
104
  s.add_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
105
+ s.add_dependency(%q<rails-app-spec>, [">= 0.2.2"])
98
106
  s.add_dependency(%q<require_all>, [">= 1.1.0"])
99
107
  s.add_dependency(%q<migration_assist>, [">= 0.1.2"])
100
108
  end
101
109
  else
102
110
  s.add_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
111
+ s.add_dependency(%q<rails-app-spec>, [">= 0.2.2"])
103
112
  s.add_dependency(%q<require_all>, [">= 1.1.0"])
104
113
  s.add_dependency(%q<migration_assist>, [">= 0.1.2"])
105
114
  end
File without changes
File without changes
File without changes
File without changes
@@ -1,14 +1,20 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'migration' do
4
- use_helpers :app, :migration
3
+ Rails::Migration::Assist.orm = :active_record
4
+
5
+ describe 'migration' do
6
+ use_orm :active_record
7
+ use_helpers :migration
5
8
 
6
9
  before :each do
7
10
  remove_migration :create_account
8
11
 
9
12
  create_migration :create_account do
10
13
  %q{
11
- def index
14
+ def self.up
15
+ end
16
+
17
+ def self.down
12
18
  end
13
19
  }
14
20
  end
@@ -25,10 +31,19 @@ describe 'migration' do
25
31
  end
26
32
  read_migration(:create_account).should have_comment 'hello'
27
33
  puts read_migration(:create_account)
28
- # root_dir.should have_migration :create_account do |migration_file|
29
- # migration_file.should have_method :index
30
- # migration_file.should have_comment 'hello'
31
- # migration_file.should have_comment 'goodbye'
32
- # end
34
+
35
+ # puts migration_file_name :create_account
36
+
37
+ # puts existing_file_name :create_account, :migration
38
+
39
+ root_dir.should have_migration :create_account
40
+
41
+ lambda {existing_migration_file :blip}.should raise_error
42
+
43
+ root_dir.should have_migration :create_account do |migration_file|
44
+ migration_file.should have_class_method :up
45
+ migration_file.should have_comment 'hello'
46
+ migration_file.should have_comment 'goodbye'
47
+ end
33
48
  end
34
49
  end
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'view API - symbols' do
4
+ use_helpers :app, :view
5
+
6
+ before :each do
7
+ remove_view :account, :edit
8
+ create_view :account, :edit do
9
+ %q{
10
+ <h1><%= title %></h1>
11
+ }
12
+ end
13
+ end
14
+
15
+ after :each do
16
+ # remove_view :account
17
+ end
18
+
19
+ it "should have an account_view file that contains an index method and two inserted comments" do
20
+ insert_into_view :account, :edit, :content => '# hello', :before => '<h1>'
21
+ insert_into_view :account, :edit, :before => '<h1>' do
22
+ '# goodbye'
23
+ end
24
+ puts read_view(:account, :edit)
25
+ read_view(:account, :edit).should have_comment 'hello'
26
+
27
+ # root_dir.should have_view :account do |view_file|
28
+ # view_file.should have_method :index
29
+ # view_file.should have_comment 'hello'
30
+ # view_file.should have_comment 'goodbye'
31
+ # end
32
+ end
33
+ end
34
+
35
+ # describe 'view API - hash' do
36
+ # use_helpers :app, :view
37
+ #
38
+ # before :each do
39
+ # remove_view :account, :action => :edit
40
+ # create_view :account, :action => :edit do
41
+ # %q{
42
+ # <h1><%= title %></h1>
43
+ # }
44
+ # end
45
+ # end
46
+ #
47
+ # after :each do
48
+ # # remove_view :account
49
+ # end
50
+ #
51
+ # it "should have an account_view file that contains an index method and two inserted comments" do
52
+ # insert_into_view :account, :action => :edit, :content => '# hello', :before => '<h1>'
53
+ # insert_into_view :account, :action => :edit, :before => '<h1>' do
54
+ # '# goodbye'
55
+ # end
56
+ # puts read_view(:account, :action => :edit)
57
+ # read_view(:account, :action => :edit).should have_comment 'hello'
58
+ # puts view_file_name(:account, :edit)
59
+ # # root_dir.should have_view :account do |view_file|
60
+ # # view_file.should have_method :index
61
+ # # view_file.should have_comment 'hello'
62
+ # # view_file.should have_comment 'goodbye'
63
+ # # end
64
+ # end
65
+ # end
@@ -2,10 +2,8 @@ require 'rspec'
2
2
  require 'rspec/autorun'
3
3
  # require 'generator_spec'
4
4
  require 'rails3_assist'
5
+ require 'rails-app-spec'
5
6
  require 'tmpdir'
6
- require 'file-spec'
7
- require 'code-spec'
8
- # require 'rails3_app_spec'
9
7
 
10
8
  # RSpec::Generator.configure do |config|
11
9
  # config.debug = false
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 2
9
- version: 0.2.2
8
+ - 3
9
+ version: 0.2.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-19 00:00:00 +02:00
17
+ date: 2010-09-04 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -35,9 +35,24 @@ dependencies:
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- name: require_all
38
+ name: rails-app-spec
39
39
  prerelease: false
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ segments:
46
+ - 0
47
+ - 2
48
+ - 2
49
+ version: 0.2.2
50
+ type: :development
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: require_all
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
41
56
  none: false
42
57
  requirements:
43
58
  - - ">="
@@ -48,11 +63,11 @@ dependencies:
48
63
  - 0
49
64
  version: 1.1.0
50
65
  type: :runtime
51
- version_requirements: *id002
66
+ version_requirements: *id003
52
67
  - !ruby/object:Gem::Dependency
53
68
  name: migration_assist
54
69
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
70
+ requirement: &id004 !ruby/object:Gem::Requirement
56
71
  none: false
57
72
  requirements:
58
73
  - - ">="
@@ -63,7 +78,7 @@ dependencies:
63
78
  - 2
64
79
  version: 0.1.2
65
80
  type: :runtime
66
- version_requirements: *id003
81
+ version_requirements: *id004
67
82
  description: Assist in operating on Rails 3 artifacts including migrations
68
83
  email: kmandrup@gmail.com
69
84
  executables: []
@@ -103,6 +118,10 @@ files:
103
118
  - lib/rails3_assist/rspec/macro.rb
104
119
  - rails3_assist.gemspec
105
120
  - rails_generator.log
121
+ - spec/fixtures/log/development.log
122
+ - spec/fixtures/log/production.log
123
+ - spec/fixtures/log/server.log
124
+ - spec/fixtures/log/test.log
106
125
  - spec/load_spec.rb
107
126
  - spec/rails3_assist/app/app_dirs_spec.rb
108
127
  - spec/rails3_assist/app/app_file_names_spec.rb
@@ -116,7 +135,8 @@ files:
116
135
  - spec/rails3_assist/artifact/orm/active_record_spec.rb
117
136
  - spec/rails3_assist/artifact/orm/mongo_mapper_spec.rb
118
137
  - spec/rails3_assist/artifact/orm/mongoid_spec.rb
119
- - spec/rails3_assist/artifact/view_spec/view_spec.rb
138
+ - spec/rails3_assist/artifact/view_spec/view_controller_action_spec.rb
139
+ - spec/rails3_assist/artifact/view_spec/view_controller_default_action_specc.rb
120
140
  - spec/spec_helper.rb
121
141
  has_rdoc: true
122
142
  homepage: http://github.com/kristianmandrup/rails3-assist
@@ -164,5 +184,6 @@ test_files:
164
184
  - spec/rails3_assist/artifact/orm/active_record_spec.rb
165
185
  - spec/rails3_assist/artifact/orm/mongo_mapper_spec.rb
166
186
  - spec/rails3_assist/artifact/orm/mongoid_spec.rb
167
- - spec/rails3_assist/artifact/view_spec/view_spec.rb
187
+ - spec/rails3_assist/artifact/view_spec/view_controller_action_spec.rb
188
+ - spec/rails3_assist/artifact/view_spec/view_controller_default_action_specc.rb
168
189
  - spec/spec_helper.rb