rails-app-spec 0.2.13 → 0.2.14

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/Rakefile CHANGED
@@ -2,8 +2,8 @@ begin
2
2
  require 'jeweler'
3
3
  Jeweler::Tasks.new do |gem|
4
4
  gem.name = "rails-app-spec"
5
- gem.summary = %Q{RSpec 2 matchers to spec the structure of your Rails 3 app}
6
- gem.description = %Q{RSpec 2 matchers to spec the structure of your Rails 3 app}
5
+ gem.summary = %Q{Spec the structure of your Rails 3 app}
6
+ gem.description = %Q{RSpec 2 matchers to help spec the structure and content of your Rails 3 app}
7
7
  gem.email = "kmandrup@gmail.com"
8
8
  gem.homepage = "http://github.com/kristianmandrup/rails-app-spec"
9
9
  gem.authors = ["Kristian Mandrup"]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.13
1
+ 0.2.14
@@ -23,7 +23,7 @@ module RSpec::RailsApp::Artifact
23
23
  return nil if !artifact_found
24
24
 
25
25
  # check file content for class or subclass
26
- self.content = File.read(artifact_found)
26
+ @content = File.read(artifact_found)
27
27
 
28
28
  if artifact_type == :view
29
29
  yield content if block
@@ -30,17 +30,16 @@ module Artifact::Matcher
30
30
  def parse_type artifact_type
31
31
  @artifact_type = artifact_type
32
32
  @postfix = artifact_type.to_s.camelize if has_postfix? artifact_type
33
+ @type = :class
33
34
  case artifact_type
34
35
  when :helper, :controller
35
36
  # artifact class check
36
- @class_type = :class
37
- @type = :class
37
+ @class_type = :class
38
38
  when :observer, :migration, :mailer, :permit
39
39
  @class_type = :subclass
40
40
  # artifact subclass check
41
41
  @superclass = SUPERCLASS_MAP[artifact_type]
42
42
  when :model
43
- # check class == name
44
43
  @class_type = :class
45
44
  end
46
45
  end
@@ -123,13 +122,13 @@ module Artifact::Matcher
123
122
  def failure_message
124
123
  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
125
124
  puts "Content: #{content}"
126
- "Expected the file: #{artifact_name} to have a #{artifact_type} class. The class should #{should_be_msg}"
125
+ "Expected the #{artifact_name} file at: #{artifact_found} to have a #{artifact_type} class. The class should #{should_be_msg}. RegExp: #{main_expr}"
127
126
  end
128
127
 
129
128
  def negative_failure_message
130
129
  return "Did not expect the #{artifact_type} #{artifact_name} to exist at #{artifact_found}, but it did" if !@file_found
131
130
  puts "Content: #{content}"
132
- "Did not expected the file: #{artifact_name} to have a #{artifact_type} class. The class should not #{should_be_msg}"
131
+ "Did not expected #{artifact_name} at file: #{artifact_found} to have a #{artifact_type} class. The class should not #{should_be_msg}. RegExp: #{main_expr}"
133
132
  end
134
133
  end
135
134
  end
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rails-app-spec}
8
- s.version = "0.2.13"
8
+ s.version = "0.2.14"
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
12
  s.date = %q{2010-09-20}
13
- s.description = %q{RSpec 2 matchers to spec the structure of your Rails 3 app}
13
+ s.description = %q{RSpec 2 matchers to help spec the structure and content of your Rails 3 app}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
@@ -71,7 +71,7 @@ Gem::Specification.new do |s|
71
71
  s.rdoc_options = ["--charset=UTF-8"]
72
72
  s.require_paths = ["lib"]
73
73
  s.rubygems_version = %q{1.3.7}
74
- s.summary = %q{RSpec 2 matchers to spec the structure of your Rails 3 app}
74
+ s.summary = %q{Spec the structure of your Rails 3 app}
75
75
  s.test_files = [
76
76
  "spec/rails_app_spec/matchers/artifact/controller_spec.rb",
77
77
  "spec/rails_app_spec/matchers/artifact/core/have_artifacts_spec.rb",
@@ -79,6 +79,7 @@ Gem::Specification.new do |s|
79
79
  "spec/rails_app_spec/matchers/artifact/mailer_spec.rb",
80
80
  "spec/rails_app_spec/matchers/artifact/migration/migration_simple_number_spec.rb",
81
81
  "spec/rails_app_spec/matchers/artifact/migration/migration_spec.rb",
82
+ "spec/rails_app_spec/matchers/artifact/model_mongoid_spec.rb",
82
83
  "spec/rails_app_spec/matchers/artifact/model_spec.rb",
83
84
  "spec/rails_app_spec/matchers/artifact/observer_spec.rb",
84
85
  "spec/rails_app_spec/matchers/artifact/view_spec.rb",
@@ -3,6 +3,7 @@ require 'spec_helper'
3
3
  root_dir = Rails3::Assist::Directory.rails_root
4
4
 
5
5
  describe 'controller' do
6
+ use_orm :none
6
7
  use_helpers :controller, :app
7
8
 
8
9
  before :each do
@@ -19,25 +20,32 @@ describe 'controller' do
19
20
  remove_controllers :account, :person
20
21
  end
21
22
 
22
- # it "should not have :controller artifact :person" do
23
- # root_dir.should_not have_artifact :person, :controller
24
- # end
25
- #
26
- # it "should have an account_controller file that contains an AccountController class with an index method inside" do
27
- # root_dir.should have_artifact :account, :controller do |content|
28
- # content.should have_method :index
29
- # end
30
- #
31
- # create_controller :person do
32
- # %q{
33
- # def index
34
- # end
35
- # }
36
- # end
37
- #
38
- # root_dir.should have_artifacts :controller, :account, :person
39
- # root_dir.should have_artifacts :controller, [:account, :person]
40
- # end
23
+ it "should not have :controller artifact :person" do
24
+ root_dir.should_not have_artifact :person, :controller
25
+ end
26
+
27
+ it "should have model" do
28
+ create_model :user
29
+ root_dir.should have_artifact :user, :model
30
+ puts read_model :user
31
+ root_dir.should have_model :user
32
+ end
33
+
34
+ it "should have an account_controller file that contains an AccountController class with an index method inside" do
35
+ root_dir.should have_artifact :account, :controller do |content|
36
+ content.should have_method :index
37
+ end
38
+
39
+ create_controller :person do
40
+ %q{
41
+ def index
42
+ end
43
+ }
44
+ end
45
+
46
+ root_dir.should have_artifacts :controller, :account, :person
47
+ root_dir.should have_artifacts :controller, [:account, :person]
48
+ end
41
49
 
42
50
  it "should not have :controller artifacts :account and :user" do
43
51
  root_dir.should_not have_artifacts :controller, [:account, :user]
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ root_dir = Rails3::Assist::Directory.rails_root
4
+
5
+ describe 'model helper' do
6
+ use_orm :mongoid
7
+
8
+ before :each do
9
+ create_model :account do
10
+ %q{
11
+ # hello
12
+ def do_it
13
+ end
14
+ }
15
+ end
16
+
17
+ create_model :person, :content => '# hello'
18
+ end
19
+
20
+ after :each do
21
+ remove_models :account, :person
22
+ end
23
+
24
+ it "should have an :account model file that contains an Account class" do
25
+ puts read_model :account
26
+ root_dir.should have_model_file :account do |file|
27
+ file.should have_model_class :account
28
+ file.should have_comment 'hello'
29
+ file.should have_method :do_it
30
+ end
31
+ root_dir.should have_model :account do |clazz|
32
+ puts clazz
33
+ clazz.should have_comment 'hello'
34
+ clazz.should have_method :do_it
35
+ end
36
+ root_dir.should_not have_model :user
37
+ end
38
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 13
9
- version: 0.2.13
8
+ - 14
9
+ version: 0.2.14
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup
@@ -156,7 +156,7 @@ dependencies:
156
156
  version: 0.2.10
157
157
  type: :runtime
158
158
  version_requirements: *id009
159
- description: RSpec 2 matchers to spec the structure of your Rails 3 app
159
+ description: RSpec 2 matchers to help spec the structure and content of your Rails 3 app
160
160
  email: kmandrup@gmail.com
161
161
  executables: []
162
162
 
@@ -215,6 +215,7 @@ files:
215
215
  - spec/rails_app_spec/matchers/special/have_gem_spec.rb
216
216
  - spec/rails_app_spec/matchers/special/have_gems_spec.rb
217
217
  - spec/spec_helper.rb
218
+ - spec/rails_app_spec/matchers/artifact/model_mongoid_spec.rb
218
219
  has_rdoc: true
219
220
  homepage: http://github.com/kristianmandrup/rails-app-spec
220
221
  licenses: []
@@ -246,7 +247,7 @@ rubyforge_project:
246
247
  rubygems_version: 1.3.7
247
248
  signing_key:
248
249
  specification_version: 3
249
- summary: RSpec 2 matchers to spec the structure of your Rails 3 app
250
+ summary: Spec the structure of your Rails 3 app
250
251
  test_files:
251
252
  - spec/rails_app_spec/matchers/artifact/controller_spec.rb
252
253
  - spec/rails_app_spec/matchers/artifact/core/have_artifacts_spec.rb
@@ -254,6 +255,7 @@ test_files:
254
255
  - spec/rails_app_spec/matchers/artifact/mailer_spec.rb
255
256
  - spec/rails_app_spec/matchers/artifact/migration/migration_simple_number_spec.rb
256
257
  - spec/rails_app_spec/matchers/artifact/migration/migration_spec.rb
258
+ - spec/rails_app_spec/matchers/artifact/model_mongoid_spec.rb
257
259
  - spec/rails_app_spec/matchers/artifact/model_spec.rb
258
260
  - spec/rails_app_spec/matchers/artifact/observer_spec.rb
259
261
  - spec/rails_app_spec/matchers/artifact/view_spec.rb