rails-app-spec 0.2.0 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/.document +0 -0
  2. data/.gitignore +0 -0
  3. data/.rspec +0 -0
  4. data/LICENSE +0 -0
  5. data/README.markdown +0 -0
  6. data/Rakefile +0 -0
  7. data/VERSION +1 -1
  8. data/lib/rails-app-spec.rb +3 -19
  9. data/lib/rails_app_spec/matchers/artifact/class/have_artifact_class.rb +0 -0
  10. data/lib/rails_app_spec/matchers/artifact/class/have_artifact_subclass.rb +1 -1
  11. data/lib/rails_app_spec/matchers/artifact/have_artifact.rb +39 -19
  12. data/lib/rails_app_spec/matchers/artifact/have_artifact_file.rb +2 -3
  13. data/lib/rails_app_spec/matchers/artifact/have_rails_artifact_file.rb +68 -0
  14. data/lib/rails_app_spec/matchers/file/have_rails_dir.rb +2 -3
  15. data/lib/rails_app_spec/matchers/file/have_rails_file.rb +31 -46
  16. data/lib/rails_app_spec/namespaces.rb +5 -0
  17. data/rails-app-spec.gemspec +8 -4
  18. data/sandbox/dir_logic.rb +0 -0
  19. data/sandbox/file_logic.rb +0 -0
  20. data/spec/load_spec.rb +0 -0
  21. data/spec/rails_app_spec/matchers/artifact/controller_spec.rb +7 -1
  22. data/spec/rails_app_spec/matchers/artifact/helper_spec.rb +2 -0
  23. data/spec/rails_app_spec/matchers/artifact/mailer_spec.rb +3 -1
  24. data/spec/rails_app_spec/matchers/artifact/{migration_spec.rb → migration/migration_simple_number_spec.rb} +12 -9
  25. data/spec/rails_app_spec/matchers/artifact/migration/migration_spec.rb +50 -0
  26. data/spec/rails_app_spec/matchers/artifact/model_spec.rb +0 -0
  27. data/spec/rails_app_spec/matchers/artifact/observer_spec.rb +2 -0
  28. data/spec/rails_app_spec/matchers/artifact/view_spec.rb +0 -0
  29. data/spec/rails_app_spec/matchers/file/have_dir_spec.rb +0 -0
  30. data/spec/rails_app_spec/matchers/file/have_file_spec.rb +0 -0
  31. data/spec/spec_helper.rb +2 -2
  32. metadata +9 -5
data/.document CHANGED
File without changes
data/.gitignore CHANGED
File without changes
data/.rspec CHANGED
File without changes
data/LICENSE CHANGED
File without changes
data/README.markdown CHANGED
File without changes
data/Rakefile CHANGED
File without changes
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.3
@@ -1,28 +1,12 @@
1
1
  require 'rspec'
2
+ require 'rails3_artifactor'
2
3
  require 'rails3_assist'
3
4
  require 'require_all'
4
5
  require 'code-spec'
6
+ require 'active_support/inflector'
5
7
  require 'file-spec'
6
8
 
7
- module RSpec
8
- module RailsApp
9
- module Artifact
10
- end
11
-
12
- module ArtifactClass
13
- end
14
-
15
- module ArtifactFile
16
- end
17
-
18
- module File
19
- end
20
-
21
- module Dir
22
- end
23
- end
24
- end
25
-
9
+ require 'rails_app_spec/namespaces'
26
10
  require_all File.dirname(__FILE__) + '/rails_app_spec/matchers'
27
11
 
28
12
  RSpec.configure do |config|
@@ -22,7 +22,7 @@ module RSpec::RailsApp::ArtifactClass
22
22
  # alias_method :be_observer_class, :have_observer_class
23
23
 
24
24
  def have_mailer_class klass
25
- have_artifact_subclass klass, 'ActionMailer::Base'
25
+ have_artifact_subclass klass, 'ActionMailer::Base', :mailer
26
26
  end
27
27
  # alias_method :be_mailer_class, :have_mailer_class
28
28
 
@@ -4,11 +4,11 @@ module RSpec::RailsApp::Artifact
4
4
  module Matchers
5
5
  class HaveArtifact < RSpec::RubyContentMatcher
6
6
 
7
- include ::Rails::Assist::App
7
+ # include ::Rails3::Assist::Directory
8
8
 
9
- include Rails::Migration::Assist::ClassMethods
10
- include ::Rails::Assist::BaseHelper::FileName
11
- include ::Rails::Assist::Migration::FileName
9
+ # include Rails::Migration::Assist::ClassMethods
10
+ include Rails3::Assist::Artifact::FileName
11
+ # include ::Rails3::Assist::Migration::FileName
12
12
 
13
13
  attr_accessor :artifact_type, :artifact_name, :class_type, :content
14
14
  # class
@@ -17,6 +17,8 @@ module RSpec::RailsApp::Artifact
17
17
  attr_accessor :superclass
18
18
 
19
19
  attr_accessor :folder, :action, :view_ext
20
+
21
+ attr_accessor :artifact_found
20
22
 
21
23
  SUPERCLASS_MAP = {
22
24
  :observer => 'ActiveRecord::Observer',
@@ -24,7 +26,7 @@ module RSpec::RailsApp::Artifact
24
26
  :migration => 'ActiveRecord::Migration'
25
27
  }
26
28
 
27
- POSTFIX = [:helper, :observer, :controller]
29
+ POSTFIX = [:helper, :observer, :controller, :mailer]
28
30
 
29
31
  def has_postfix? key
30
32
  POSTFIX.include? key
@@ -33,6 +35,8 @@ module RSpec::RailsApp::Artifact
33
35
  def initialize(name, artifact_type)
34
36
  self.artifact_type = artifact_type
35
37
 
38
+ extend "Rails3::Assist::Artifact::#{artifact_type.to_s.camelize}".constantize
39
+
36
40
  if name.kind_of? Hash
37
41
  view_options = name
38
42
  self.folder = view_options[:folder]
@@ -64,22 +68,38 @@ module RSpec::RailsApp::Artifact
64
68
  end
65
69
  end
66
70
 
67
- def matches?(generator, &block)
68
- self.artifact_name = case artifact_type
69
- when :view
70
- File.expand_path(send :"#{artifact_type}_file_name", folder, action, view_ext)
71
- else
72
- found_file = send :existing_file_name, artifact_name, artifact_type if respond_to? :existing_file_name
73
- # send :"#{artifact_type}_file_name", artifact_name
71
+ def matches?(root_path, &block)
72
+ @root_path = root_path
73
+ artifact_found = case artifact_type
74
+ when :view
75
+ find_view_method = "#{artifact_type}_file_name"
76
+ File.expand_path(send find_view_method, folder, action, view_ext, :root_path => root_path)
77
+ else
78
+ find_existing_artifact_method = "existing_#{artifact_type}_file"
79
+ if respond_to? find_existing_artifact_method
80
+ begin
81
+ send find_existing_artifact_method, artifact_name, artifact_type, :root_path => root_path
82
+ rescue Exception => e
83
+ @error_msg = e.message
84
+ @trace = e.backtrace.join "\n"
85
+ nil
86
+ end
87
+ else
88
+ raise "The method ##{find_existing_artifact_method} to find the artifact was not available"
89
+ end
90
+ end
91
+ if !artifact_found
92
+ self.artifact_found = '[unknown]'
93
+ return nil
74
94
  end
75
95
 
76
- self.artifact_name = File.expand_path(artifact_name)
77
-
78
- @file_found = File.file?(artifact_name)
96
+ @file_found = File.file?(artifact_found)
79
97
  return nil if !@file_found
80
98
 
99
+ artifact_found = File.expand_path(artifact_found)
100
+
81
101
  # check file content for class or subclass
82
- self.content = File.read(artifact_name)
102
+ self.content = File.read(artifact_found)
83
103
 
84
104
  if artifact_type == :view
85
105
  yield content if block
@@ -117,13 +137,13 @@ module RSpec::RailsApp::Artifact
117
137
  end
118
138
 
119
139
  def failure_message
120
- return "Expected the #{type} #{artifact_name} to exist, but it didn't" if !@file_found
140
+ return "Expected the #{artifact_type} #{artifact_name} to exist at #{artifact_found} (root = #{@root_path}), but it didn't.\nError: #{@error_msg}.\n\nTrace:\n #{@trace}" if !@file_found
121
141
  puts "Content: #{content}"
122
142
  "Expected the file: #{artifact_name} to have a #{artifact_type} class. The class should #{should_be_msg}"
123
143
  end
124
144
 
125
145
  def negative_failure_message
126
- return "Did not expect the #{type} #{artifact_name} to exist, but it did" if !@file_found
146
+ return "Did not expect the #{artifact_type} #{artifact_name} to exist at #{artifact_found}, but it did" if !@file_found
127
147
  puts "Content: #{content}"
128
148
  "Did not expected the file: #{artifact_name} to have a #{artifact_type} class. The class should not #{should_be_msg}"
129
149
  end
@@ -134,7 +154,7 @@ module RSpec::RailsApp::Artifact
134
154
  end
135
155
  alias_method :contain_artifact, :have_artifact
136
156
 
137
- (::Rails::Assist.artifacts - [:view]).each do |name|
157
+ (::Rails3::Assist.artifacts - [:view]).each do |name|
138
158
  class_eval %{
139
159
  def have_#{name} relative
140
160
  have_artifact relative, :#{name}
@@ -1,11 +1,10 @@
1
1
  module RSpec::RailsApp::ArtifactFile
2
2
  module Matchers
3
- include ::Rails::Assist::App
4
3
 
5
- (::Rails::Assist.artifacts - [:view]).each do |name|
4
+ (::Rails3::Assist.artifacts - [:view]).each do |name|
6
5
  class_eval %{
7
6
  def have_#{name}_file relative
8
- have_rails_file relative, :#{name}
7
+ have_rails_artifact_file relative, :#{name}
9
8
  end
10
9
  alias_method :contain_#{name}_file, :have_#{name}_file
11
10
  }
@@ -0,0 +1,68 @@
1
+ module RSpec::RailsApp::ArtifactFile
2
+ module Matchers
3
+ class HaveRailsArtifactFile
4
+
5
+ # include Rails::Migration::Assist::ClassMethods
6
+ include ::Rails3::Assist::Artifact::FileName
7
+ # include ::Rails::Assist::Migration::FileName
8
+
9
+ attr_accessor :name, :artifact_type, :artifact_name
10
+
11
+ attr_accessor :folder, :action, :view_ext
12
+
13
+ def initialize(name, artifact_type = nil)
14
+ self.artifact_type = artifact_type
15
+
16
+ extend "Rails3::Assist::Artifact::#{artifact_type.to_s.camelize}".constantize
17
+
18
+ if name.kind_of? Hash
19
+ view_options = name
20
+ self.folder = view_options[:folder]
21
+ self.action = view_options[:action]
22
+ self.view_ext = view_options[:view_ext]
23
+ self.artifact_type = :view
24
+ return nil
25
+ end
26
+ self.artifact_name = name.to_s
27
+ end
28
+
29
+ def matches?(root_path, &block)
30
+ self.artifact_name = case artifact_type
31
+ when :view
32
+ find_view_method = "#{artifact_type}_file_name"
33
+ File.expand_path(send find_view_method, folder, action, view_ext, :root_path => root_path)
34
+ else
35
+ find_existing_artifact_method = "existing_#{artifact_type}_file"
36
+ if respond_to? find_existing_artifact_method
37
+ send find_existing_artifact_method, artifact_name, artifact_type, :root_path => root_path
38
+ else
39
+ raise "The method ##{find_existing_artifact_method} to find the artifact was not available"
40
+ end
41
+ end
42
+
43
+ # puts "artifact_name: #{artifact_name}"
44
+
45
+ match = File.file? artifact_name
46
+ if block && match
47
+ yield File.read(artifact_name)
48
+ end
49
+ match
50
+ end
51
+
52
+ def failure_message
53
+ "Expected the #{artifact_type} #{artifact_name} to exist, but it didn't"
54
+ end
55
+
56
+ def negative_failure_message
57
+ "Did not expect the #{artifact_type} #{artifact_name} to exist, but it did"
58
+ end
59
+
60
+ end
61
+
62
+ def have_rails_artifact_file(relative, artifact_type = nil)
63
+ HaveRailsArtifactFile.new(relative, artifact_type)
64
+ end
65
+ alias_method :contain_rails_artifact_file, :have_rails_artifact_file
66
+ end
67
+ end
68
+
@@ -1,7 +1,6 @@
1
1
  module RSpec::RailsApp::Dir
2
2
  module Matchers
3
3
  class HaveRailsDir
4
- include ::Rails::Assist::App
5
4
 
6
5
  attr_accessor :dir, :type
7
6
 
@@ -27,7 +26,7 @@ module RSpec::RailsApp::Dir
27
26
  HaveRailsDir.new(type)
28
27
  end
29
28
 
30
- ::Rails::Assist::App::RailsDirs.root_directories.each do |name|
29
+ ::Rails3::Assist::Directory::Root.root_directories.each do |name|
31
30
  class_eval %{
32
31
  def have_#{name}_dir
33
32
  have_rails_dir :#{name}
@@ -35,7 +34,7 @@ module RSpec::RailsApp::Dir
35
34
  }
36
35
  end
37
36
 
38
- ::Rails::Assist::App::RailsDirs.app_directories.each do |name|
37
+ ::Rails3::Assist::Directory::App.app_directories.each do |name|
39
38
  class_eval %{
40
39
  def have_#{name}_dir
41
40
  have_rails_dir :#{name}
@@ -1,62 +1,47 @@
1
1
  module RSpec::RailsApp::File
2
- module Matchers
2
+ module Matchers
3
3
  class HaveRailsFile
4
- include ::Rails::Assist::App
5
-
6
- include Rails::Migration::Assist::ClassMethods
7
- include ::Rails::Assist::BaseHelper::FileName
8
- include ::Rails::Assist::Migration::FileName
4
+ include ::Rails3::Assist::Artifact
9
5
 
10
- attr_accessor :name, :artifact_type, :artifact_name
11
-
12
- attr_accessor :folder, :action, :view_ext
6
+ attr_reader :file, :type, :name
13
7
 
14
- def initialize(name, artifact_type = nil)
15
- self.artifact_type = artifact_type
16
-
17
- if name.kind_of? Hash
18
- view_options = name
19
- self.folder = view_options[:folder]
20
- self.action = view_options[:action]
21
- self.view_ext = view_options[:view_ext]
22
- self.artifact_type = :view
23
- return nil
24
- end
25
- self.artifact_name = name.to_s
8
+ def initialize(name, type = nil)
9
+ @type = type if type
10
+ @name = name
26
11
  end
27
12
 
28
- def matches?(generator, &block)
29
- self.artifact_name = case artifact_type
30
- when :view
31
- File.expand_path(send :"#{artifact_type}_file_name", folder, action, view_ext)
32
- else
33
- found_file = send :existing_file_name, artifact_name, artifact_type if respond_to? :existing_file_name
34
- # send :"#{artifact_type}_file_name", artifact_name
35
- end
36
-
37
- # puts "artifact_name: #{artifact_name}"
38
-
39
- match = File.file? artifact_name
40
- if block && match
41
- yield File.read(artifact_name)
42
- end
43
- match
13
+ def matches?(obj, &block)
14
+ @file = type ? send(:"#{type}_file", name) : send(:"#{name}_file")
15
+ File.file? file
44
16
  end
45
17
 
46
18
  def failure_message
47
- "Expected the #{artifact_type} #{artifact_name} to exist, but it didn't"
19
+ "Expected Rails app to have file: #{file}, but it didn't"
48
20
  end
49
21
 
50
22
  def negative_failure_message
51
- "Did not expect the #{artifact_type} #{artifact_name} to exist, but it did"
52
- end
53
-
23
+ "Did not expected Rails app to have file: #{file}, but it did"
24
+ end
54
25
  end
55
26
 
56
- def have_rails_file(relative, artifact_type = nil)
57
- HaveRailsFile.new(relative, artifact_type)
27
+ def have_rails_file(type = nil)
28
+ HaveRailsFile.new(type)
29
+ end
30
+
31
+ [:initializer, :db, :migration, :locale, :javascript, :stylesheet].each do |name|
32
+ class_eval %{
33
+ def have_#{name}_file name
34
+ have_rails_file name, :#{name}
35
+ end
36
+ }
58
37
  end
59
- alias_method :contain_rails_file, :have_rails_file
60
- end
61
- end
62
38
 
39
+ [:application, :seed, :environment].each do |name|
40
+ class_eval %{
41
+ def have_#{name}_file
42
+ have_rails_file #{name}
43
+ end
44
+ }
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,5 @@
1
+ module RSpec
2
+ module RailsApp
3
+ modules :artifact, :artifact_class, :artifact_file, :file, :dir
4
+ end
5
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rails-app-spec}
8
- s.version = "0.2.0"
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-20}
12
+ s.date = %q{2010-09-11}
13
13
  s.description = %q{RSpec 2 matchers to spec the structure of your Rails 3 app}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -29,8 +29,10 @@ Gem::Specification.new do |s|
29
29
  "lib/rails_app_spec/matchers/artifact/class/have_artifact_subclass.rb",
30
30
  "lib/rails_app_spec/matchers/artifact/have_artifact.rb",
31
31
  "lib/rails_app_spec/matchers/artifact/have_artifact_file.rb",
32
+ "lib/rails_app_spec/matchers/artifact/have_rails_artifact_file.rb",
32
33
  "lib/rails_app_spec/matchers/file/have_rails_dir.rb",
33
34
  "lib/rails_app_spec/matchers/file/have_rails_file.rb",
35
+ "lib/rails_app_spec/namespaces.rb",
34
36
  "rails-app-spec.gemspec",
35
37
  "sandbox/dir_logic.rb",
36
38
  "sandbox/file_logic.rb",
@@ -38,7 +40,8 @@ Gem::Specification.new do |s|
38
40
  "spec/rails_app_spec/matchers/artifact/controller_spec.rb",
39
41
  "spec/rails_app_spec/matchers/artifact/helper_spec.rb",
40
42
  "spec/rails_app_spec/matchers/artifact/mailer_spec.rb",
41
- "spec/rails_app_spec/matchers/artifact/migration_spec.rb",
43
+ "spec/rails_app_spec/matchers/artifact/migration/migration_simple_number_spec.rb",
44
+ "spec/rails_app_spec/matchers/artifact/migration/migration_spec.rb",
42
45
  "spec/rails_app_spec/matchers/artifact/model_spec.rb",
43
46
  "spec/rails_app_spec/matchers/artifact/observer_spec.rb",
44
47
  "spec/rails_app_spec/matchers/artifact/view_spec.rb",
@@ -56,7 +59,8 @@ Gem::Specification.new do |s|
56
59
  "spec/rails_app_spec/matchers/artifact/controller_spec.rb",
57
60
  "spec/rails_app_spec/matchers/artifact/helper_spec.rb",
58
61
  "spec/rails_app_spec/matchers/artifact/mailer_spec.rb",
59
- "spec/rails_app_spec/matchers/artifact/migration_spec.rb",
62
+ "spec/rails_app_spec/matchers/artifact/migration/migration_simple_number_spec.rb",
63
+ "spec/rails_app_spec/matchers/artifact/migration/migration_spec.rb",
60
64
  "spec/rails_app_spec/matchers/artifact/model_spec.rb",
61
65
  "spec/rails_app_spec/matchers/artifact/observer_spec.rb",
62
66
  "spec/rails_app_spec/matchers/artifact/view_spec.rb",
data/sandbox/dir_logic.rb CHANGED
File without changes
File without changes
data/spec/load_spec.rb CHANGED
File without changes
@@ -1,7 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
+ root_dir = Rails3::Assist::Directory.rails_root
4
+
3
5
  describe 'controller' do
4
- use_helpers :app, :controller
6
+ use_helper :controller
5
7
 
6
8
  before :each do
7
9
  create_empty_tmp :controller
@@ -16,6 +18,10 @@ describe 'controller' do
16
18
  after :each do
17
19
  remove_controller :account
18
20
  end
21
+
22
+ it "should not have an person controller file" do
23
+ root_dir.should_not have_controller :person
24
+ end
19
25
 
20
26
  it "should have an account_controller file that contains an AccountController class with an index method inside" do
21
27
  root_dir.should have_controller :account do |content|
@@ -1,5 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
+ root_dir = Rails3::Assist::Directory.rails_root
4
+
3
5
  describe 'rails helper' do
4
6
  use_helper :helper
5
7
 
@@ -1,5 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
+ root_dir = Rails3::Assist::Directory.rails_root
4
+
3
5
  describe 'mailer helper' do
4
6
  load_helper :mailer
5
7
 
@@ -13,7 +15,7 @@ describe 'mailer helper' do
13
15
  end
14
16
 
15
17
  after :each do
16
- remove_mailer :account
18
+ # remove_mailer :account
17
19
  end
18
20
 
19
21
  it "should have an account mailer file with a mail_it! method inside" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- Rails::Migration::Assist.orm = :active_record
3
+ # Rails::Migration::Assist.orm = :active_record
4
4
 
5
5
  describe 'migration' do
6
6
  # use_orm :active_record
@@ -12,17 +12,20 @@ describe 'migration' do
12
12
  create_migration :create_account do
13
13
  %q{ def self.up
14
14
  end
15
-
15
+
16
16
  def self.down
17
17
  end}
18
18
  end
19
19
  end
20
20
 
21
21
  after :each do
22
- # remove_migration :create_account
22
+ remove_migration :create_account
23
23
  end
24
24
 
25
25
  it "should have an create_account_migration file that contains an index method and two inserted comments" do
26
+ existing_migration_file_name = existing_file_name :create_account, :migration
27
+ FileUtils.mv existing_migration_file_name, existing_migration_file_name.gsub(/\d+_/, '001_')
28
+
26
29
  insert_into_migration :create_account, :content => '# hello'
27
30
  insert_into_migration :create_account do
28
31
  '# goodbye'
@@ -30,14 +33,14 @@ describe 'migration' do
30
33
  read_migration(:create_account).should have_comment 'hello'
31
34
  puts read_migration(:create_account)
32
35
 
33
- puts migration_file_name :create_account
36
+ # puts migration_file_name :create_account
34
37
 
35
38
  root_dir.should have_migration :create_account
36
39
 
37
- # root_dir.should have_migration :create_account do |migration_file|
38
- # migration_file.should have_method :index
39
- # migration_file.should have_comment 'hello'
40
- # migration_file.should have_comment 'goodbye'
41
- # end
40
+ root_dir.should have_migration :create_account do |migration_file|
41
+ migration_file.should have_class_method :up
42
+ migration_file.should have_comment 'hello'
43
+ migration_file.should have_comment 'goodbye'
44
+ end
42
45
  end
43
46
  end
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+
3
+ Rails::Migration::Assist.orm = :active_record
4
+
5
+ root_dir = Rails::Migration::Assist.rails_root_dir
6
+
7
+ describe 'migration' do
8
+ use_orm :active_record
9
+ use_helper :migration
10
+
11
+ before :each do
12
+ remove_migration :create_account
13
+
14
+ create_migration :create_account do
15
+ %q{ def self.up
16
+ end
17
+
18
+ def self.down
19
+ end}
20
+ end
21
+ end
22
+
23
+ after :each do
24
+ remove_migration :create_account
25
+ end
26
+
27
+ it "should have an create_account_migration file that contains an index method and two inserted comments" do
28
+ insert_into_migration :create_account, :content => '# hello'
29
+ insert_into_migration :create_account do
30
+ '# goodbye'
31
+ end
32
+ read_migration(:create_account).should have_comment 'hello'
33
+ puts read_migration(:create_account)
34
+
35
+ # puts migration_file_name :create_account
36
+ existing_file_name :create_account, :migration
37
+
38
+ root_dir.should_not have_migration :create_creative_accounting
39
+
40
+ # root_dir.should have_migration :create_creative_accounting
41
+
42
+ root_dir.should have_migration :create_account
43
+
44
+ root_dir.should have_migration :create_account do |migration_file|
45
+ migration_file.should have_class_method :up
46
+ migration_file.should have_comment 'hello'
47
+ migration_file.should have_comment 'goodbye'
48
+ end
49
+ end
50
+ end
File without changes
@@ -1,5 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
+ root_dir = Rails3::Assist::Directory.rails_root
4
+
3
5
  describe 'observer helper' do
4
6
  use_helper :observer
5
7
 
File without changes
File without changes
File without changes
data/spec/spec_helper.rb CHANGED
@@ -4,7 +4,7 @@ require 'rails-app-spec'
4
4
 
5
5
  RSpec.configure do |config|
6
6
  config.before do
7
- Rails::Assist::App.rails_root_dir = temp_dir('tmp_rails')
7
+ Rails3::Assist::Directory.rails_root = temp_dir('tmp_rails')
8
8
  end
9
9
 
10
10
  config.after do
@@ -28,4 +28,4 @@ end
28
28
 
29
29
  def remove_temp_dir name
30
30
  FileUtils.rm_rf temp_dir(name)
31
- end
31
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
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-20 00:00:00 +02:00
17
+ date: 2010-09-11 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -116,8 +116,10 @@ files:
116
116
  - lib/rails_app_spec/matchers/artifact/class/have_artifact_subclass.rb
117
117
  - lib/rails_app_spec/matchers/artifact/have_artifact.rb
118
118
  - lib/rails_app_spec/matchers/artifact/have_artifact_file.rb
119
+ - lib/rails_app_spec/matchers/artifact/have_rails_artifact_file.rb
119
120
  - lib/rails_app_spec/matchers/file/have_rails_dir.rb
120
121
  - lib/rails_app_spec/matchers/file/have_rails_file.rb
122
+ - lib/rails_app_spec/namespaces.rb
121
123
  - rails-app-spec.gemspec
122
124
  - sandbox/dir_logic.rb
123
125
  - sandbox/file_logic.rb
@@ -125,7 +127,8 @@ files:
125
127
  - spec/rails_app_spec/matchers/artifact/controller_spec.rb
126
128
  - spec/rails_app_spec/matchers/artifact/helper_spec.rb
127
129
  - spec/rails_app_spec/matchers/artifact/mailer_spec.rb
128
- - spec/rails_app_spec/matchers/artifact/migration_spec.rb
130
+ - spec/rails_app_spec/matchers/artifact/migration/migration_simple_number_spec.rb
131
+ - spec/rails_app_spec/matchers/artifact/migration/migration_spec.rb
129
132
  - spec/rails_app_spec/matchers/artifact/model_spec.rb
130
133
  - spec/rails_app_spec/matchers/artifact/observer_spec.rb
131
134
  - spec/rails_app_spec/matchers/artifact/view_spec.rb
@@ -169,7 +172,8 @@ test_files:
169
172
  - spec/rails_app_spec/matchers/artifact/controller_spec.rb
170
173
  - spec/rails_app_spec/matchers/artifact/helper_spec.rb
171
174
  - spec/rails_app_spec/matchers/artifact/mailer_spec.rb
172
- - spec/rails_app_spec/matchers/artifact/migration_spec.rb
175
+ - spec/rails_app_spec/matchers/artifact/migration/migration_simple_number_spec.rb
176
+ - spec/rails_app_spec/matchers/artifact/migration/migration_spec.rb
173
177
  - spec/rails_app_spec/matchers/artifact/model_spec.rb
174
178
  - spec/rails_app_spec/matchers/artifact/observer_spec.rb
175
179
  - spec/rails_app_spec/matchers/artifact/view_spec.rb