riot-rails 0.0.10.pre.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/{test/rails_root/app/views/rendered_templates/foo_bar.html.erb → README.md} +0 -0
  2. data/Rakefile +10 -32
  3. data/VERSION +1 -1
  4. data/init.rb +0 -0
  5. data/install.rb +0 -0
  6. data/lib/generators/riot_rails.rb +10 -0
  7. data/lib/generators/riot_rails/model/model_generator.rb +22 -0
  8. data/lib/generators/riot_rails/model/templates/fixtures.yml +23 -0
  9. data/lib/generators/riot_rails/model/templates/riot_test.rb +5 -0
  10. metadata +26 -155
  11. data/.gitignore +0 -4
  12. data/CHANGELOG +0 -144
  13. data/MIT-LICENSE +0 -20
  14. data/README.markdown +0 -31
  15. data/lib/riot/action_controller.rb +0 -4
  16. data/lib/riot/action_controller/context_macros/asserts_response.rb +0 -15
  17. data/lib/riot/action_controller/context_middleware.rb +0 -45
  18. data/lib/riot/action_controller/http_methods.rb +0 -19
  19. data/lib/riot/active_record.rb +0 -4
  20. data/lib/riot/active_record/assertion_macros.rb +0 -3
  21. data/lib/riot/active_record/context_middleware.rb +0 -15
  22. data/lib/riot/active_record/database_macros.rb +0 -58
  23. data/lib/riot/active_record/reflection_macros.rb +0 -106
  24. data/lib/riot/active_record/transactional_middleware.rb +0 -21
  25. data/lib/riot/active_record/validation_macros.rb +0 -187
  26. data/lib/riot/rails.rb +0 -1
  27. data/rails/init.rb +0 -1
  28. data/riot-rails.gemspec +0 -130
  29. data/test/action_controller/context_macros/asserts_response_test.rb +0 -35
  30. data/test/action_controller/context_middleware_test.rb +0 -66
  31. data/test/action_controller/delete_request_test.rb +0 -45
  32. data/test/action_controller/get_request_test.rb +0 -37
  33. data/test/action_controller/post_request_test.rb +0 -45
  34. data/test/action_controller/put_request_test.rb +0 -45
  35. data/test/action_controller/restful_delete_request_test.rb +0 -28
  36. data/test/action_controller/restful_get_request_test.rb +0 -25
  37. data/test/action_controller/restful_post_request_test.rb +0 -25
  38. data/test/action_controller/restful_put_request_test.rb +0 -28
  39. data/test/active_record/allowing_values_test.rb +0 -64
  40. data/test/active_record/attribute_is_invalid_test.rb +0 -20
  41. data/test/active_record/belongs_to_test.rb +0 -22
  42. data/test/active_record/context_middleware_test.rb +0 -18
  43. data/test/active_record/has_and_belongs_to_many_test.rb +0 -22
  44. data/test/active_record/has_database_index_on_test.rb +0 -73
  45. data/test/active_record/has_many_test.rb +0 -22
  46. data/test/active_record/has_one_test.rb +0 -22
  47. data/test/active_record/validates_length_of_test.rb +0 -31
  48. data/test/active_record/validates_presence_of_test.rb +0 -14
  49. data/test/active_record/validates_uniqueness_of_test.rb +0 -23
  50. data/test/rails_root/app/controllers/gremlins_controller.rb +0 -21
  51. data/test/rails_root/app/controllers/parties_controller.rb +0 -17
  52. data/test/rails_root/app/controllers/rooms_controller.rb +0 -22
  53. data/test/rails_root/config/database.yml +0 -4
  54. data/test/rails_root/config/environment.rb +0 -46
  55. data/test/rails_root/config/routes.rb +0 -7
  56. data/test/rails_root/db/schema.rb +0 -8
  57. data/test/teststrap.rb +0 -84
  58. data/test/transactional_middleware_test.rb +0 -26
data/Rakefile CHANGED
@@ -1,41 +1,19 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- task :default => [:test]
5
-
6
- require 'rake/testtask'
7
- Rake::TestTask.new(:test) do |test|
8
- test.libs << 'lib' << 'test'
9
- test.pattern = 'test/**/*_test.rb'
10
- test.verbose = false
11
- end
12
-
13
- desc "Run Flog against library (except tests)"
14
- task :flog do
15
- puts %x[find ./lib -name *.rb | xargs flog]
16
- end
17
-
18
- desc "Run Roodi against library (except tests)"
19
- task :roodi do
20
- puts %x[find ./lib -name *.rb | xargs roodi]
1
+ begin
2
+ require 'rubygems'
3
+ rescue LoadError
4
+ puts "Can't find RubyGems..."
21
5
  end
22
6
 
23
- #
24
- # Some monks like diamonds. I like gems.
25
-
26
7
  begin
27
8
  require 'jeweler'
28
9
  Jeweler::Tasks.new do |gem|
29
10
  gem.name = "riot-rails"
30
- gem.summary = "Riot specific test support for Rails apps"
31
- gem.description = "Riot specific test support for Rails apps. Protest the slow app."
32
- gem.email = "gus@gusg.us"
33
- gem.homepage = "http://github.com/thumblemonks/riot-rails"
34
- gem.authors = ["Justin 'Gus' Knowlden"]
35
- gem.add_dependency("riot", ">= 0.11.0")
36
- gem.add_dependency("rack-test", ">= 0.5.3")
37
- gem.add_development_dependency("activerecord", ">= 3.0.0.beta3")
38
- gem.add_development_dependency("actionpack", ">= 3.0.0.beta3")
11
+ gem.summary = "Test your Rails apps with Riot"
12
+ gem.description = "Use the fast, expressive and concise Riot unit-testing framework to test your Rails apps with."
13
+ gem.email = "daniel.schierbeck@gmail.com"
14
+ gem.homepage = "http://github.com/dasch/riot-rails"
15
+ gem.authors = ["Daniel Schierbeck"]
16
+ gem.add_dependency 'riot'
39
17
  end
40
18
  Jeweler::GemcutterTasks.new
41
19
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.10.pre.3
1
+ 0.1.0
data/init.rb ADDED
File without changes
data/install.rb ADDED
File without changes
@@ -0,0 +1,10 @@
1
+ require 'rails/generators/named_base'
2
+
3
+ require 'riot'
4
+
5
+ module RiotRails
6
+ module Generators
7
+ class Base < Rails::Generators::NamedBase #:nodoc:
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,22 @@
1
+ require 'generators/riot_rails'
2
+
3
+ module RiotRails
4
+ module Generators
5
+ class ModelGenerator < Base
6
+ argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
7
+ class_option :fixture, :type => :boolean
8
+
9
+ def create_test_file
10
+ template File.join(File.dirname(__FILE__), 'templates', 'riot_test.rb'), File.join('test/unit', class_path, "#{file_name}_test.rb")
11
+ end
12
+
13
+ hook_for :fixture_replacement
14
+
15
+ def create_fixture_file
16
+ if options[:fixture] && options[:fixture_replacement].nil?
17
+ template File.join(File.dirname(__FILE__), 'templates', 'fixtures.yml'), File.join('test/fixtures', "#{table_name}.yml")
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ <% unless attributes.empty? -%>
4
+ one:
5
+ <% for attribute in attributes -%>
6
+ <%= attribute.name %>: <%= attribute.default %>
7
+ <% end -%>
8
+
9
+ two:
10
+ <% for attribute in attributes -%>
11
+ <%= attribute.name %>: <%= attribute.default %>
12
+ <% end -%>
13
+ <% else -%>
14
+ # This model initially had no columns defined. If you add columns to the
15
+ # model remove the '{}' from the fixture names and add the columns immediately
16
+ # below each fixture, per the syntax in the comments below
17
+ #
18
+ one: {}
19
+ # column: value
20
+ #
21
+ two: {}
22
+ # column: value
23
+ <% end -%>
@@ -0,0 +1,5 @@
1
+ require 'test_helper'
2
+
3
+ context "A <%= class_name %>" do
4
+ asserts("1 + 1") { 1 + 1 }.equals{2}
5
+ end
metadata CHANGED
@@ -1,144 +1,47 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riot-rails
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
5
- segments:
6
- - 0
7
- - 0
8
- - 10
9
- - pre
10
- - 3
11
- version: 0.0.10.pre.3
4
+ version: 0.1.0
12
5
  platform: ruby
13
6
  authors:
14
- - Justin 'Gus' Knowlden
7
+ - Daniel Schierbeck
15
8
  autorequire:
16
9
  bindir: bin
17
10
  cert_chain: []
18
11
 
19
- date: 2010-06-04 00:00:00 -05:00
12
+ date: 2010-02-06 00:00:00 +01:00
20
13
  default_executable:
21
14
  dependencies:
22
15
  - !ruby/object:Gem::Dependency
23
16
  name: riot
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- segments:
30
- - 0
31
- - 11
32
- - 0
33
- version: 0.11.0
34
- type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rack-test
38
- prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- segments:
44
- - 0
45
- - 5
46
- - 3
47
- version: 0.5.3
48
17
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: activerecord
52
- prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- segments:
58
- - 3
59
- - 0
60
- - 0
61
- - beta3
62
- version: 3.0.0.beta3
63
- type: :development
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- name: actionpack
67
- prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
69
20
  requirements:
70
21
  - - ">="
71
22
  - !ruby/object:Gem::Version
72
- segments:
73
- - 3
74
- - 0
75
- - 0
76
- - beta3
77
- version: 3.0.0.beta3
78
- type: :development
79
- version_requirements: *id004
80
- description: Riot specific test support for Rails apps. Protest the slow app.
81
- email: gus@gusg.us
23
+ version: "0"
24
+ version:
25
+ description: Use the fast, expressive and concise Riot unit-testing framework to test your Rails apps with.
26
+ email: daniel.schierbeck@gmail.com
82
27
  executables: []
83
28
 
84
29
  extensions: []
85
30
 
86
31
  extra_rdoc_files:
87
- - README.markdown
32
+ - README.md
88
33
  files:
89
- - .gitignore
90
- - CHANGELOG
91
- - MIT-LICENSE
92
- - README.markdown
34
+ - README.md
93
35
  - Rakefile
94
36
  - VERSION
95
- - lib/riot/action_controller.rb
96
- - lib/riot/action_controller/context_macros/asserts_response.rb
97
- - lib/riot/action_controller/context_middleware.rb
98
- - lib/riot/action_controller/http_methods.rb
99
- - lib/riot/active_record.rb
100
- - lib/riot/active_record/assertion_macros.rb
101
- - lib/riot/active_record/context_middleware.rb
102
- - lib/riot/active_record/database_macros.rb
103
- - lib/riot/active_record/reflection_macros.rb
104
- - lib/riot/active_record/transactional_middleware.rb
105
- - lib/riot/active_record/validation_macros.rb
106
- - lib/riot/rails.rb
107
- - rails/init.rb
108
- - riot-rails.gemspec
109
- - test/action_controller/context_macros/asserts_response_test.rb
110
- - test/action_controller/context_middleware_test.rb
111
- - test/action_controller/delete_request_test.rb
112
- - test/action_controller/get_request_test.rb
113
- - test/action_controller/post_request_test.rb
114
- - test/action_controller/put_request_test.rb
115
- - test/action_controller/restful_delete_request_test.rb
116
- - test/action_controller/restful_get_request_test.rb
117
- - test/action_controller/restful_post_request_test.rb
118
- - test/action_controller/restful_put_request_test.rb
119
- - test/active_record/allowing_values_test.rb
120
- - test/active_record/attribute_is_invalid_test.rb
121
- - test/active_record/belongs_to_test.rb
122
- - test/active_record/context_middleware_test.rb
123
- - test/active_record/has_and_belongs_to_many_test.rb
124
- - test/active_record/has_database_index_on_test.rb
125
- - test/active_record/has_many_test.rb
126
- - test/active_record/has_one_test.rb
127
- - test/active_record/validates_length_of_test.rb
128
- - test/active_record/validates_presence_of_test.rb
129
- - test/active_record/validates_uniqueness_of_test.rb
130
- - test/rails_root/app/controllers/gremlins_controller.rb
131
- - test/rails_root/app/controllers/parties_controller.rb
132
- - test/rails_root/app/controllers/rooms_controller.rb
133
- - test/rails_root/app/views/rendered_templates/foo_bar.html.erb
134
- - test/rails_root/config/database.yml
135
- - test/rails_root/config/environment.rb
136
- - test/rails_root/config/routes.rb
137
- - test/rails_root/db/schema.rb
138
- - test/teststrap.rb
139
- - test/transactional_middleware_test.rb
37
+ - init.rb
38
+ - install.rb
39
+ - lib/generators/riot_rails.rb
40
+ - lib/generators/riot_rails/model/model_generator.rb
41
+ - lib/generators/riot_rails/model/templates/fixtures.yml
42
+ - lib/generators/riot_rails/model/templates/riot_test.rb
140
43
  has_rdoc: true
141
- homepage: http://github.com/thumblemonks/riot-rails
44
+ homepage: http://github.com/dasch/riot-rails
142
45
  licenses: []
143
46
 
144
47
  post_install_message:
@@ -150,52 +53,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
150
53
  requirements:
151
54
  - - ">="
152
55
  - !ruby/object:Gem::Version
153
- segments:
154
- - 0
155
56
  version: "0"
57
+ version:
156
58
  required_rubygems_version: !ruby/object:Gem::Requirement
157
59
  requirements:
158
- - - ">"
60
+ - - ">="
159
61
  - !ruby/object:Gem::Version
160
- segments:
161
- - 1
162
- - 3
163
- - 1
164
- version: 1.3.1
62
+ version: "0"
63
+ version:
165
64
  requirements: []
166
65
 
167
66
  rubyforge_project:
168
- rubygems_version: 1.3.6
67
+ rubygems_version: 1.3.5
169
68
  signing_key:
170
69
  specification_version: 3
171
- summary: Riot specific test support for Rails apps
172
- test_files:
173
- - test/action_controller/context_macros/asserts_response_test.rb
174
- - test/action_controller/context_middleware_test.rb
175
- - test/action_controller/delete_request_test.rb
176
- - test/action_controller/get_request_test.rb
177
- - test/action_controller/post_request_test.rb
178
- - test/action_controller/put_request_test.rb
179
- - test/action_controller/restful_delete_request_test.rb
180
- - test/action_controller/restful_get_request_test.rb
181
- - test/action_controller/restful_post_request_test.rb
182
- - test/action_controller/restful_put_request_test.rb
183
- - test/active_record/allowing_values_test.rb
184
- - test/active_record/attribute_is_invalid_test.rb
185
- - test/active_record/belongs_to_test.rb
186
- - test/active_record/context_middleware_test.rb
187
- - test/active_record/has_and_belongs_to_many_test.rb
188
- - test/active_record/has_database_index_on_test.rb
189
- - test/active_record/has_many_test.rb
190
- - test/active_record/has_one_test.rb
191
- - test/active_record/validates_length_of_test.rb
192
- - test/active_record/validates_presence_of_test.rb
193
- - test/active_record/validates_uniqueness_of_test.rb
194
- - test/rails_root/app/controllers/gremlins_controller.rb
195
- - test/rails_root/app/controllers/parties_controller.rb
196
- - test/rails_root/app/controllers/rooms_controller.rb
197
- - test/rails_root/config/environment.rb
198
- - test/rails_root/config/routes.rb
199
- - test/rails_root/db/schema.rb
200
- - test/teststrap.rb
201
- - test/transactional_middleware_test.rb
70
+ summary: Test your Rails apps with Riot
71
+ test_files: []
72
+
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- test/rails_root/log/*
2
- pkg/*
3
- riot-rails.tmproj
4
- test/rails_root/db/*.db
data/CHANGELOG DELETED
@@ -1,144 +0,0 @@
1
- *0.0.10.pre.3*
2
-
3
- * Renamed to riot-rails and am hoping @dasch is kind of enough to let me be an owner on the gem he originally pushed. The ol' bait and and switch. [jaknowlden]
4
-
5
- * Added asserts_response context macro. You can also provide method names to be called against the response. [jaknowlden]
6
-
7
- context FoosController do
8
- setup { get "/foos" }
9
-
10
- asserts_response.exists
11
- asserts_response(:status).equals(200)
12
- asserts_response(:body).matches(/Bar baz/)
13
- end # FoosController
14
-
15
- * Added GET support for ActionController testing, a la Rack testing methods. [jaknowlden]
16
-
17
- context MyController do
18
- setup { get "/my/dashboard", "foo" => "bar" }
19
- end # MyController
20
-
21
- * Redoing support for ActionController. Dropped everything started from scratch. Also, moved the context-helper stuff into Riot and called it ContextMiddleware. Reimplemented helpers as middleware here. [jaknowlden]
22
-
23
- *0.0.9.pre*
24
-
25
- * To accommodate the last change, added concept of context helpers. It's so simple you can define your own. [jaknowlden]
26
-
27
- module RiotRails
28
- register_context_helper do
29
- def prepare_context(original_description, context)
30
- # ...
31
- context.<do-something-before-the-context-runs-if-you-want-to>
32
- # ...
33
- end
34
- end
35
- end
36
-
37
- * Well. Aren't we special? We don't have include ActiveRecord or ActionController code if we don't want to. But if you do: [jaknowlden]
38
-
39
- # teststrap.rb
40
- require 'riot/activerecord' # implicit riot/rails require
41
- require 'riot/actioncontroller' # also an implicit riot/rails require
42
-
43
- * Added asserts_request and asserts_response context macros. They also take a possible method to call.
44
- [jaknowlden]
45
-
46
- rails_context UsersController do
47
- hookup { get :show, :id => 1 }
48
-
49
- asserts_response.kind_of(ActionController::TestResponse)
50
- asserts_response(:body).kind_of(String)
51
-
52
- asserts_request.kind_of(ActionController::TestRequest)
53
- asserts_request(:cookies).kind_of(Hash)
54
- end
55
-
56
- * Controller assertions now no longer assume the actual value is a controller instance. Instead, the actual
57
- value is something that should quack like a response. [jaknowlden]
58
-
59
- * Added asserts_assigned context macro [jaknowlden]
60
-
61
- rails_context UsersController do
62
- hookup { get :show, :id => 1 }
63
-
64
- asserts_assigned(:user).kind_of(User)
65
- end
66
-
67
- * rails_context now recognizes controllers [jaknowlden]
68
-
69
- rails_context RoomsController do
70
- hookup { get :index }
71
- asserts_controller.reponse_status :ok
72
- end
73
-
74
- Plus, you can only use controlling within a rails_context now
75
-
76
- rails_context "rooms" do
77
- controlling :rooms
78
- hookup { get :index }
79
- asserts_controller.reponse_status :ok
80
- end
81
-
82
- * controlling now lets you pass a controller class reference in [jaknowlden]
83
-
84
- rails_context "rooms" do
85
- controlling RoomsController
86
- end
87
-
88
- * Reflection macros now test the options [emschwar]
89
-
90
- rails_context Room do
91
- asserts_topic.has_one :floor, :class_name => "Surface"
92
- asserts_topic.has_many :walls, :join_table => "foos"
93
- end
94
-
95
- * Added the has_one reflection macro [emschwar]
96
-
97
- rails_context Room do
98
- asserts_topic.has_one :floor
99
- end
100
-
101
- * Added the attribute_is_invalid validation macro [jaknowlden]
102
-
103
- rails_context Room do
104
- hookup { topic.location = nil }
105
- asserts_topic.attribute_is_invalid(:location, "can't be blank")
106
- end
107
-
108
- * Added validates_length_of assertion macro (minimalistic) [jaknowlden]
109
-
110
- rails_context Room do
111
- asserts_topic.validates_length_of :name, (2..36)
112
- end
113
-
114
- * Added transactional support to RailsContext. Disabled by default [jaknowlden]
115
-
116
- rails_context Room do
117
- set :transactional, true
118
- end
119
-
120
- * Added option enabling to RailsContext [jaknowlden]
121
-
122
- rails_context Room do
123
- set :this, "that"
124
- end
125
-
126
- * Added initial #rails_context. Assumes ActiveRecord class for now [jaknowlden]
127
-
128
- class Room < ActiveRecord::Base
129
- # ...
130
- end
131
-
132
- # TEST
133
-
134
- rails_context Room do
135
- asserts_topic.belongs_to(:house)
136
- asserts_topic.validates_presence_of(:house_id)
137
- end
138
-
139
- * Added the #belongs_to ActiveRecord assertion macro [jaknowlden]
140
-
141
- context "a Room" do
142
- setup { Room.new }
143
- asserts_topic.belongs_to(:house)
144
- end