aktion_test_rails 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/.gitignore +3 -0
  2. data/.rvmrc +1 -1
  3. data/.travis.yml +3 -6
  4. data/CHANGELOG.md +35 -0
  5. data/Gemfile +18 -3
  6. data/README.md +12 -1
  7. data/Rakefile +2 -8
  8. data/aktion_test_rails.gemspec +1 -4
  9. data/lib/aktion_test_rails/load.rb +18 -0
  10. data/lib/aktion_test_rails/matchers/active_admin/flash.rb +93 -0
  11. data/lib/aktion_test_rails/matchers/active_admin.rb +50 -0
  12. data/lib/aktion_test_rails/matchers/factory_girl/validation.rb +58 -0
  13. data/lib/aktion_test_rails/matchers/factory_girl.rb +7 -2
  14. data/lib/aktion_test_rails/support/active_admin/request/sign_in.rb +17 -0
  15. data/lib/aktion_test_rails/support/active_admin/request.rb +16 -0
  16. data/lib/aktion_test_rails/support/capybara/rack_app.rb +13 -0
  17. data/lib/aktion_test_rails/support/rails/model_builder.rb +59 -0
  18. data/lib/aktion_test_rails/version.rb +1 -1
  19. data/lib/aktion_test_rails.rb +56 -3
  20. data/spec/aktion_test_rails/model_builder_spec.rb +68 -0
  21. data/spec/matchers/active_admin/flash_spec.rb +141 -0
  22. data/spec/matchers/factory_girl/validation_spec.rb +71 -0
  23. data/spec/rails_app/.gitignore +15 -0
  24. data/spec/rails_app/Rakefile +7 -0
  25. data/spec/rails_app/app/admin/admin_user.rb +22 -0
  26. data/spec/rails_app/app/admin/dashboard.rb +33 -0
  27. data/spec/rails_app/app/assets/images/.gitkeep +0 -0
  28. data/spec/rails_app/app/assets/javascripts/active_admin.js +1 -0
  29. data/spec/rails_app/app/assets/javascripts/application.js +15 -0
  30. data/spec/rails_app/app/assets/stylesheets/active_admin.css.scss +29 -0
  31. data/spec/rails_app/app/assets/stylesheets/application.css +13 -0
  32. data/spec/rails_app/app/controllers/application_controller.rb +3 -0
  33. data/spec/rails_app/app/models/admin_user.rb +11 -0
  34. data/spec/rails_app/app/views/layouts/application.html.erb +14 -0
  35. data/spec/rails_app/config/application.rb +19 -0
  36. data/spec/rails_app/config/boot.rb +3 -0
  37. data/spec/rails_app/config/database.yml +5 -0
  38. data/spec/rails_app/config/environment.rb +2 -0
  39. data/spec/rails_app/config/environments/test.rb +37 -0
  40. data/spec/rails_app/config/initializers/active_admin.rb +7 -0
  41. data/spec/rails_app/config/initializers/devise.rb +11 -0
  42. data/spec/rails_app/config/initializers/secret_token.rb +1 -0
  43. data/spec/rails_app/config/initializers/session_store.rb +1 -0
  44. data/spec/rails_app/config/initializers/wrap_parameters.rb +6 -0
  45. data/spec/rails_app/config/locales/devise.en.yml +58 -0
  46. data/spec/rails_app/config/locales/en.yml +9 -0
  47. data/spec/rails_app/config/routes.rb +5 -0
  48. data/spec/rails_app/config.ru +4 -0
  49. data/spec/rails_app/db/migrate/20121126141714_devise_create_admin_users.rb +52 -0
  50. data/spec/rails_app/db/migrate/20121126141717_create_admin_notes.rb +17 -0
  51. data/spec/rails_app/db/migrate/20121126141718_move_admin_notes_to_comments.rb +25 -0
  52. data/spec/rails_app/public/404.html +26 -0
  53. data/spec/rails_app/public/422.html +26 -0
  54. data/spec/rails_app/public/500.html +25 -0
  55. data/spec/rails_app/public/favicon.ico +0 -0
  56. data/spec/rails_app/public/robots.txt +5 -0
  57. data/spec/rails_app/script/rails +6 -0
  58. data/spec/requests/active_admin/sign_in_spec.rb +34 -0
  59. data/spec/spec_active_record.rb +13 -0
  60. data/spec/spec_base.rb +28 -0
  61. data/spec/spec_rails.rb +18 -0
  62. metadata +99 -60
  63. data/Appraisals +0 -15
  64. data/gemfiles/3.0.gemfile +0 -8
  65. data/gemfiles/3.0.gemfile.lock +0 -175
  66. data/gemfiles/3.1.gemfile +0 -10
  67. data/gemfiles/3.1.gemfile.lock +0 -196
  68. data/gemfiles/3.2.gemfile +0 -10
  69. data/gemfiles/3.2.gemfile.lock +0 -194
  70. data/lib/aktion_test_rails/class_builder.rb +0 -29
  71. data/lib/aktion_test_rails/matchers/factory_girl/have_a_valid_factory.rb +0 -49
  72. data/lib/aktion_test_rails/matchers/integrations/rspec.rb +0 -9
  73. data/lib/aktion_test_rails/matchers.rb +0 -1
  74. data/lib/aktion_test_rails/model_builder.rb +0 -70
  75. data/spec/matchers/factory_girl/have_a_valid_factory_spec.rb +0 -64
  76. data/spec/spec_helper.rb +0 -27
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,34 @@
1
+ require 'spec_base'
2
+ require 'spec_rails'
3
+
4
+ describe AktionTestRails::Support::ActiveAdmin::Request::SignIn do
5
+ include described_class
6
+
7
+ before(:each) do
8
+ unless FactoryGirl.factories.registered?(:admin_user)
9
+ FactoryGirl.define do
10
+ factory :admin_user do
11
+ sequence(:email) {|n| "admin-#{n}@example.com"}
12
+ password 'password'
13
+ password_confirmation 'password'
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ it "should create and sign in an admin user" do
20
+ sign_in_active_admin
21
+ page.should have_content "Signed in successfully."
22
+ current_path.should == '/admin'
23
+ end
24
+
25
+ it "should create an admin user" do
26
+ expect { sign_in_active_admin }.to change { AdminUser.count }.by 1
27
+ @admin.should be_a AdminUser
28
+ end
29
+
30
+ it "should not create an admin user if it already exists" do
31
+ @admin = FactoryGirl.create(:admin_user)
32
+ expect { sign_in_active_admin }.to_not change { AdminUser.count }
33
+ end
34
+ end
@@ -0,0 +1,13 @@
1
+ require 'active_record'
2
+ require 'rspec/rails/adapters'
3
+ require 'rspec/rails/fixture_support'
4
+
5
+ if RUBY_PLATFORM =~ /java/
6
+ ActiveRecord::Base.establish_connection(adapter: 'jdbcsqlite3', database: 'tmp/test.sqlite3')
7
+ else
8
+ ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'tmp/test.sqlite3')
9
+ end
10
+
11
+ RSpec.configure do |config|
12
+ config.use_transactional_fixtures = true
13
+ end
data/spec/spec_base.rb ADDED
@@ -0,0 +1,28 @@
1
+ ENV['RAILS_ENV'] = 'test'
2
+
3
+ require 'simplecov'
4
+
5
+ SimpleCov.start do
6
+ add_filter '/tmp/'
7
+ add_filter '/spec/'
8
+ add_filter '/lib/aktion_test_rails/matchers/factory_girl.rb'
9
+ add_filter '/lib/aktion_test_rails/matchers/active_admin.rb'
10
+ add_filter '/lib/aktion_test_rails/support/active_admin/request.rb'
11
+ add_filter '/lib/aktion_test_rails/rails.rb'
12
+ add_filter '/lib/aktion_test_rails.rb'
13
+ minimum_coverage 100
14
+ end
15
+
16
+ FileUtils.mkdir('tmp') unless Dir.exists?('tmp')
17
+
18
+ require 'aktion_test_rails'
19
+ require 'capybara'
20
+ require 'active_support/core_ext/string'
21
+
22
+ Dir[File.join(File.dirname(__FILE__), 'support', '**', '*.rb')].each{|file| require file}
23
+
24
+ RSpec.configure do |config|
25
+ config.treat_symbols_as_metadata_keys_with_true_values = true
26
+ config.run_all_when_everything_filtered = true
27
+ config.order = 'random'
28
+ end
@@ -0,0 +1,18 @@
1
+ TESTAPP_ROOT = File.join(File.dirname(__FILE__), 'rails_app')
2
+ PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')).freeze
3
+
4
+ $:.unshift File.dirname(__FILE__)
5
+ $:.unshift File.join(PROJECT_ROOT, 'lib')
6
+
7
+ require "rails_app/config/environment"
8
+ require 'aktion_test_rails/rails'
9
+
10
+ I18n.load_path << File.join(TESTAPP_ROOT, 'config/locales/en.yml')
11
+ I18n.load_path << File.join(TESTAPP_ROOT, 'config/locales/devise.en.yml')
12
+
13
+ ActiveRecord::Migration.verbose = false
14
+ ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
15
+
16
+ RSpec.configure do |config|
17
+ config.use_transactional_fixtures = true
18
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aktion_test_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-23 00:00:00.000000000 Z
12
+ date: 2012-12-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aktion_test
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - '='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.0.2
21
+ version: 0.1.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - '='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 0.0.2
29
+ version: 0.1.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rspec-rails
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -139,38 +139,6 @@ dependencies:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
141
  version: 1.4.1
142
- - !ruby/object:Gem::Dependency
143
- name: appraisal
144
- requirement: !ruby/object:Gem::Requirement
145
- none: false
146
- requirements:
147
- - - ~>
148
- - !ruby/object:Gem::Version
149
- version: 0.5.1
150
- type: :development
151
- prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - ~>
156
- - !ruby/object:Gem::Version
157
- version: 0.5.1
158
- - !ruby/object:Gem::Dependency
159
- name: rails
160
- requirement: !ruby/object:Gem::Requirement
161
- none: false
162
- requirements:
163
- - - ~>
164
- - !ruby/object:Gem::Version
165
- version: '3.0'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
- requirements:
171
- - - ~>
172
- - !ruby/object:Gem::Version
173
- version: '3.0'
174
142
  description: Subproject of aktion_test, adding rails versions of gems, libraries and
175
143
  rake tasks.
176
144
  email:
@@ -183,28 +151,65 @@ files:
183
151
  - .rspec
184
152
  - .rvmrc
185
153
  - .travis.yml
186
- - Appraisals
154
+ - CHANGELOG.md
187
155
  - Gemfile
188
156
  - LICENSE
189
157
  - README.md
190
158
  - Rakefile
191
159
  - aktion_test_rails.gemspec
192
- - gemfiles/3.0.gemfile
193
- - gemfiles/3.0.gemfile.lock
194
- - gemfiles/3.1.gemfile
195
- - gemfiles/3.1.gemfile.lock
196
- - gemfiles/3.2.gemfile
197
- - gemfiles/3.2.gemfile.lock
198
160
  - lib/aktion_test_rails.rb
199
- - lib/aktion_test_rails/class_builder.rb
200
- - lib/aktion_test_rails/matchers.rb
161
+ - lib/aktion_test_rails/load.rb
162
+ - lib/aktion_test_rails/matchers/active_admin.rb
163
+ - lib/aktion_test_rails/matchers/active_admin/flash.rb
201
164
  - lib/aktion_test_rails/matchers/factory_girl.rb
202
- - lib/aktion_test_rails/matchers/factory_girl/have_a_valid_factory.rb
203
- - lib/aktion_test_rails/matchers/integrations/rspec.rb
204
- - lib/aktion_test_rails/model_builder.rb
165
+ - lib/aktion_test_rails/matchers/factory_girl/validation.rb
166
+ - lib/aktion_test_rails/support/active_admin/request.rb
167
+ - lib/aktion_test_rails/support/active_admin/request/sign_in.rb
168
+ - lib/aktion_test_rails/support/capybara/rack_app.rb
169
+ - lib/aktion_test_rails/support/rails/model_builder.rb
205
170
  - lib/aktion_test_rails/version.rb
206
- - spec/matchers/factory_girl/have_a_valid_factory_spec.rb
207
- - spec/spec_helper.rb
171
+ - spec/aktion_test_rails/model_builder_spec.rb
172
+ - spec/matchers/active_admin/flash_spec.rb
173
+ - spec/matchers/factory_girl/validation_spec.rb
174
+ - spec/rails_app/.gitignore
175
+ - spec/rails_app/Rakefile
176
+ - spec/rails_app/app/admin/admin_user.rb
177
+ - spec/rails_app/app/admin/dashboard.rb
178
+ - spec/rails_app/app/assets/images/.gitkeep
179
+ - spec/rails_app/app/assets/javascripts/active_admin.js
180
+ - spec/rails_app/app/assets/javascripts/application.js
181
+ - spec/rails_app/app/assets/stylesheets/active_admin.css.scss
182
+ - spec/rails_app/app/assets/stylesheets/application.css
183
+ - spec/rails_app/app/controllers/application_controller.rb
184
+ - spec/rails_app/app/models/admin_user.rb
185
+ - spec/rails_app/app/views/layouts/application.html.erb
186
+ - spec/rails_app/config.ru
187
+ - spec/rails_app/config/application.rb
188
+ - spec/rails_app/config/boot.rb
189
+ - spec/rails_app/config/database.yml
190
+ - spec/rails_app/config/environment.rb
191
+ - spec/rails_app/config/environments/test.rb
192
+ - spec/rails_app/config/initializers/active_admin.rb
193
+ - spec/rails_app/config/initializers/devise.rb
194
+ - spec/rails_app/config/initializers/secret_token.rb
195
+ - spec/rails_app/config/initializers/session_store.rb
196
+ - spec/rails_app/config/initializers/wrap_parameters.rb
197
+ - spec/rails_app/config/locales/devise.en.yml
198
+ - spec/rails_app/config/locales/en.yml
199
+ - spec/rails_app/config/routes.rb
200
+ - spec/rails_app/db/migrate/20121126141714_devise_create_admin_users.rb
201
+ - spec/rails_app/db/migrate/20121126141717_create_admin_notes.rb
202
+ - spec/rails_app/db/migrate/20121126141718_move_admin_notes_to_comments.rb
203
+ - spec/rails_app/public/404.html
204
+ - spec/rails_app/public/422.html
205
+ - spec/rails_app/public/500.html
206
+ - spec/rails_app/public/favicon.ico
207
+ - spec/rails_app/public/robots.txt
208
+ - spec/rails_app/script/rails
209
+ - spec/requests/active_admin/sign_in_spec.rb
210
+ - spec/spec_active_record.rb
211
+ - spec/spec_base.rb
212
+ - spec/spec_rails.rb
208
213
  homepage: http://aktionlab.com
209
214
  licenses: []
210
215
  post_install_message:
@@ -217,18 +222,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
222
  - - ! '>='
218
223
  - !ruby/object:Gem::Version
219
224
  version: '0'
220
- segments:
221
- - 0
222
- hash: -2522459422363485846
223
225
  required_rubygems_version: !ruby/object:Gem::Requirement
224
226
  none: false
225
227
  requirements:
226
228
  - - ! '>='
227
229
  - !ruby/object:Gem::Version
228
230
  version: '0'
229
- segments:
230
- - 0
231
- hash: -2522459422363485846
232
231
  requirements: []
233
232
  rubyforge_project:
234
233
  rubygems_version: 1.8.24
@@ -236,5 +235,45 @@ signing_key:
236
235
  specification_version: 3
237
236
  summary: Rails testing setup
238
237
  test_files:
239
- - spec/matchers/factory_girl/have_a_valid_factory_spec.rb
240
- - spec/spec_helper.rb
238
+ - spec/aktion_test_rails/model_builder_spec.rb
239
+ - spec/matchers/active_admin/flash_spec.rb
240
+ - spec/matchers/factory_girl/validation_spec.rb
241
+ - spec/rails_app/.gitignore
242
+ - spec/rails_app/Rakefile
243
+ - spec/rails_app/app/admin/admin_user.rb
244
+ - spec/rails_app/app/admin/dashboard.rb
245
+ - spec/rails_app/app/assets/images/.gitkeep
246
+ - spec/rails_app/app/assets/javascripts/active_admin.js
247
+ - spec/rails_app/app/assets/javascripts/application.js
248
+ - spec/rails_app/app/assets/stylesheets/active_admin.css.scss
249
+ - spec/rails_app/app/assets/stylesheets/application.css
250
+ - spec/rails_app/app/controllers/application_controller.rb
251
+ - spec/rails_app/app/models/admin_user.rb
252
+ - spec/rails_app/app/views/layouts/application.html.erb
253
+ - spec/rails_app/config.ru
254
+ - spec/rails_app/config/application.rb
255
+ - spec/rails_app/config/boot.rb
256
+ - spec/rails_app/config/database.yml
257
+ - spec/rails_app/config/environment.rb
258
+ - spec/rails_app/config/environments/test.rb
259
+ - spec/rails_app/config/initializers/active_admin.rb
260
+ - spec/rails_app/config/initializers/devise.rb
261
+ - spec/rails_app/config/initializers/secret_token.rb
262
+ - spec/rails_app/config/initializers/session_store.rb
263
+ - spec/rails_app/config/initializers/wrap_parameters.rb
264
+ - spec/rails_app/config/locales/devise.en.yml
265
+ - spec/rails_app/config/locales/en.yml
266
+ - spec/rails_app/config/routes.rb
267
+ - spec/rails_app/db/migrate/20121126141714_devise_create_admin_users.rb
268
+ - spec/rails_app/db/migrate/20121126141717_create_admin_notes.rb
269
+ - spec/rails_app/db/migrate/20121126141718_move_admin_notes_to_comments.rb
270
+ - spec/rails_app/public/404.html
271
+ - spec/rails_app/public/422.html
272
+ - spec/rails_app/public/500.html
273
+ - spec/rails_app/public/favicon.ico
274
+ - spec/rails_app/public/robots.txt
275
+ - spec/rails_app/script/rails
276
+ - spec/requests/active_admin/sign_in_spec.rb
277
+ - spec/spec_active_record.rb
278
+ - spec/spec_base.rb
279
+ - spec/spec_rails.rb
data/Appraisals DELETED
@@ -1,15 +0,0 @@
1
- appraise '3.0' do
2
- gem 'rails', '3.0.17'
3
- end
4
-
5
- appraise '3.1' do
6
- gem 'rails', '3.1.8'
7
- gem 'jquery-rails'
8
- gem 'sass-rails'
9
- end
10
-
11
- appraise '3.2' do
12
- gem 'rails', '3.2.9'
13
- gem 'jquery-rails'
14
- gem 'sass-rails'
15
- end
data/gemfiles/3.0.gemfile DELETED
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "sqlite3", :platform=>:ruby
6
- gem "rails", "3.0.17"
7
-
8
- gemspec :path=>"../"