Permalink
Browse files

Trying to work on tests

  • Loading branch information...
1 parent 7ad650e commit 4af2e61292d61f66c90895cf9ea3e8853e27c465 Christian Frichot committed Jan 24, 2012
Showing with 903 additions and 185 deletions.
  1. +4 −2 Gemfile
  2. +0 −169 Gemfile.lock
  3. +17 −9 Rakefile
  4. +44 −5 devise_google_authenticator.gemspec
  5. +13 −0 test/generators_test.rb
  6. +4 −0 test/orm/active_record.rb
  7. BIN test/rails_app/app/assets/images/rails.png
  8. +9 −0 test/rails_app/app/assets/javascripts/application.js
  9. +3 −0 test/rails_app/app/assets/javascripts/posts.js.coffee
  10. +7 −0 test/rails_app/app/assets/stylesheets/application.css
  11. +3 −0 test/rails_app/app/assets/stylesheets/posts.css.scss
  12. +56 −0 test/rails_app/app/assets/stylesheets/scaffolds.css.scss
  13. +4 −0 test/rails_app/app/controllers/application_controller.rb
  14. +83 −0 test/rails_app/app/controllers/posts_controller.rb
  15. +2 −0 test/rails_app/app/helpers/application_helper.rb
  16. +2 −0 test/rails_app/app/helpers/posts_helper.rb
  17. 0 test/rails_app/app/mailers/.gitkeep
  18. 0 test/rails_app/app/models/.gitkeep
  19. +2 −0 test/rails_app/app/models/post.rb
  20. +9 −0 test/rails_app/app/models/user.rb
  21. +7 −0 test/rails_app/app/views/devise/checkga/show.html.erb
  22. +12 −0 test/rails_app/app/views/devise/displayqr/show.html.erb
  23. +14 −0 test/rails_app/app/views/layouts/application.html.erb
  24. +25 −0 test/rails_app/app/views/posts/_form.html.erb
  25. +6 −0 test/rails_app/app/views/posts/edit.html.erb
  26. +25 −0 test/rails_app/app/views/posts/index.html.erb
  27. +5 −0 test/rails_app/app/views/posts/new.html.erb
  28. +15 −0 test/rails_app/app/views/posts/show.html.erb
  29. +4 −0 test/rails_app/config.ru
  30. +23 −0 test/rails_app/config/application.rb
  31. +11 −0 test/rails_app/config/boot.rb
  32. +22 −0 test/rails_app/config/database.yml
  33. +5 −0 test/rails_app/config/environment.rb
  34. +26 −0 test/rails_app/config/environments/development.rb
  35. +49 −0 test/rails_app/config/environments/production.rb
  36. +35 −0 test/rails_app/config/environments/test.rb
  37. +7 −0 test/rails_app/config/initializers/backtrace_silencers.rb
  38. +220 −0 test/rails_app/config/initializers/devise.rb
  39. +10 −0 test/rails_app/config/initializers/inflections.rb
  40. +5 −0 test/rails_app/config/initializers/mime_types.rb
  41. +7 −0 test/rails_app/config/initializers/secret_token.rb
  42. +8 −0 test/rails_app/config/initializers/session_store.rb
  43. +14 −0 test/rails_app/config/initializers/wrap_parameters.rb
  44. +5 −0 test/rails_app/config/locales/en.yml
  45. +6 −0 test/rails_app/config/routes.rb
  46. +10 −0 test/rails_app/db/migrate/20120122052320_create_posts.rb
  47. +25 −0 test/rails_app/db/migrate/20120122052528_devise_create_users.rb
  48. +17 −0 test/rails_app/db/migrate/20120122053518_devise_google_authenticator_add_to_users.rb
  49. 0 test/rails_app/log/test.log
  50. +6 −0 test/rails_app/script/rails
  51. +17 −0 test/test_helper.rb
View
@@ -1,11 +1,13 @@
source "http://rubygems.org"
# Add dependencies required to use your gem here.
# Example:
-# gem "activesupport", ">= 2.3.5"
+gem "activesupport", "3.1.3"
gem "rails"
gem "devise"
gem "rotp"
+gemspec
+
# The below are yoinked from devise_invitable's gemfile
group :test do
gem "sqlite3"
@@ -26,5 +28,5 @@ group :development do
gem "shoulda", "~> 2.11.3"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.6.4"
- gem "rcov", ">= 0"
+ gem "simplecov"
end
View
@@ -1,169 +0,0 @@
-GEM
- remote: http://rubygems.org/
- specs:
- actionmailer (3.1.3)
- actionpack (= 3.1.3)
- mail (~> 2.3.0)
- actionpack (3.1.3)
- activemodel (= 3.1.3)
- activesupport (= 3.1.3)
- builder (~> 3.0.0)
- erubis (~> 2.7.0)
- i18n (~> 0.6)
- rack (~> 1.3.5)
- rack-cache (~> 1.1)
- rack-mount (~> 0.8.2)
- rack-test (~> 0.6.1)
- sprockets (~> 2.0.3)
- activemodel (3.1.3)
- activesupport (= 3.1.3)
- builder (~> 3.0.0)
- i18n (~> 0.6)
- activerecord (3.1.3)
- activemodel (= 3.1.3)
- activesupport (= 3.1.3)
- arel (~> 2.2.1)
- tzinfo (~> 0.3.29)
- activeresource (3.1.3)
- activemodel (= 3.1.3)
- activesupport (= 3.1.3)
- activesupport (3.1.3)
- multi_json (~> 1.0)
- arel (2.2.1)
- bcrypt-ruby (3.0.1)
- bson (1.5.2)
- bson_ext (1.5.2)
- bson (= 1.5.2)
- builder (3.0.0)
- capybara (0.4.1.2)
- celerity (>= 0.7.9)
- culerity (>= 0.2.4)
- mime-types (>= 1.16)
- nokogiri (>= 1.3.3)
- rack (>= 1.0.0)
- rack-test (>= 0.5.4)
- selenium-webdriver (>= 0.0.27)
- xpath (~> 0.1.3)
- celerity (0.9.2)
- childprocess (0.3.0)
- ffi (~> 1.0.6)
- culerity (0.2.15)
- devise (1.5.3)
- bcrypt-ruby (~> 3.0)
- orm_adapter (~> 0.0.3)
- warden (~> 1.1)
- diff-lcs (1.1.3)
- erubis (2.7.0)
- factory_girl (2.4.0)
- activesupport
- factory_girl_rails (1.5.0)
- factory_girl (~> 2.4.0)
- railties (>= 3.0.0)
- ffi (1.0.11)
- git (1.2.5)
- hike (1.2.1)
- i18n (0.6.0)
- jeweler (1.6.4)
- bundler (~> 1.0)
- git (>= 1.2.5)
- rake
- json (1.6.4)
- mail (2.3.0)
- i18n (>= 0.4.0)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- mime-types (1.17.2)
- mocha (0.9.12)
- mongo (1.5.2)
- bson (= 1.5.2)
- mongoid (2.4.0)
- activemodel (~> 3.1)
- mongo (~> 1.3)
- tzinfo (~> 0.3.22)
- multi_json (1.0.4)
- nokogiri (1.5.0)
- orm_adapter (0.0.6)
- polyglot (0.3.3)
- rack (1.3.6)
- rack-cache (1.1)
- rack (>= 0.4)
- rack-mount (0.8.3)
- rack (>= 1.0.0)
- rack-ssl (1.3.2)
- rack
- rack-test (0.6.1)
- rack (>= 1.0)
- rails (3.1.3)
- actionmailer (= 3.1.3)
- actionpack (= 3.1.3)
- activerecord (= 3.1.3)
- activeresource (= 3.1.3)
- activesupport (= 3.1.3)
- bundler (~> 1.0)
- railties (= 3.1.3)
- railties (3.1.3)
- actionpack (= 3.1.3)
- activesupport (= 3.1.3)
- rack-ssl (~> 1.3.2)
- rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (~> 0.14.6)
- rake (0.9.2.2)
- rcov (0.9.11)
- rdoc (3.12)
- json (~> 1.4)
- rotp (1.3.2)
- rspec (2.5.0)
- rspec-core (~> 2.5.0)
- rspec-expectations (~> 2.5.0)
- rspec-mocks (~> 2.5.0)
- rspec-core (2.5.2)
- rspec-expectations (2.5.0)
- diff-lcs (~> 1.1.2)
- rspec-mocks (2.5.0)
- rspec-rails (2.5.0)
- actionpack (~> 3.0)
- activesupport (~> 3.0)
- railties (~> 3.0)
- rspec (~> 2.5.0)
- rubyzip (0.9.5)
- selenium-webdriver (2.16.0)
- childprocess (>= 0.2.5)
- ffi (~> 1.0.9)
- multi_json (~> 1.0.4)
- rubyzip
- shoulda (2.11.3)
- sprockets (2.0.3)
- hike (~> 1.2)
- rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
- sqlite3 (1.3.5)
- thor (0.14.6)
- tilt (1.3.3)
- treetop (1.4.10)
- polyglot
- polyglot (>= 0.3.1)
- tzinfo (0.3.31)
- warden (1.1.0)
- rack (>= 1.0)
- xpath (0.1.4)
- nokogiri (~> 1.3)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- bson_ext (~> 1.3)
- bundler (~> 1.0.0)
- capybara (~> 0.4.0)
- devise
- factory_girl_rails (~> 1.0)
- jeweler (~> 1.6.4)
- mocha (~> 0.9.9)
- mongoid (~> 2.0)
- rails
- rcov
- rotp
- rspec-rails (~> 2.5.0)
- shoulda (~> 2.11.3)
- sqlite3
View
@@ -29,19 +29,19 @@ Jeweler::RubygemsDotOrgTasks.new
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
- test.pattern = 'test/**/test_*.rb'
+ test.pattern = 'test/**/*_test.rb'
test.verbose = true
end
-require 'rcov/rcovtask'
-Rcov::RcovTask.new do |test|
- test.libs << 'test'
- test.pattern = 'test/**/test_*.rb'
- test.verbose = true
- test.rcov_opts << '--exclude "gems/*"'
-end
+# require 'rcov/rcovtask'
+# Rcov::RcovTask.new do |test|
+# test.libs << 'test'
+# test.pattern = 'test/**/test_*.rb'
+# test.verbose = true
+# test.rcov_opts << '--exclude "gems/*"'
+# end
-task :default => :test
+task :default => :tests
require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
@@ -52,3 +52,11 @@ Rake::RDocTask.new do |rdoc|
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
+
+desc 'Run Devise tests for all ORMs.'
+task :tests do
+ Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file|
+ orm = File.basename(file).split(".").first
+ system "rake test DEVISE_ORM=#{orm}"
+ end
+end
@@ -9,14 +9,38 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Christian Frichot"]
- s.date = "2012-01-22"
+ s.date = "2012-01-23"
s.description = "Devise Google Authenticator Extension, for adding Google's OTP to your Rails apps!"
s.email = "xntrik@gmail.com"
s.extra_rdoc_files = [
"LICENSE.txt",
"README.rdoc"
]
- s.files = Dir["{app,config,lib}/**/*"] + %w[LICENSE.txt README.rdoc]
+ s.files = [
+ "LICENSE.txt",
+ "README.rdoc",
+ "app/controllers/devise/checkga_controller.rb",
+ "app/controllers/devise/displayqr_controller.rb",
+ "app/views/devise/checkga/show.html.erb",
+ "app/views/devise/displayqr/show.html.erb",
+ "config/locales/en.yml",
+ "lib/devise_google_authenticatable/controllers/helpers.rb",
+ "lib/devise_google_authenticatable/hooks/google_authenticatable.rb",
+ "lib/devise_google_authenticatable/models/google_authenticatable.rb",
+ "lib/devise_google_authenticatable/orm/active_record.rb",
+ "lib/devise_google_authenticatable/patches.rb",
+ "lib/devise_google_authenticatable/patches/check_ga.rb",
+ "lib/devise_google_authenticatable/patches/display_qr.rb",
+ "lib/devise_google_authenticatable/rails.rb",
+ "lib/devise_google_authenticatable/routes.rb",
+ "lib/devise_google_authenticatable/schema.rb",
+ "lib/devise_google_authenticator.rb",
+ "lib/generators/active_record/devise_google_authenticator_generator.rb",
+ "lib/generators/active_record/templates/migration.rb",
+ "lib/generators/devise_google_authenticator/devise_google_authenticator_generator.rb",
+ "lib/generators/devise_google_authenticator/install_generator.rb",
+ "lib/generators/devise_google_authenticator/views_generator.rb"
+ ]
s.homepage = "http://github.com/AsteriskLabs/devise_google_authenticator"
s.licenses = ["MIT"]
s.require_paths = ["lib"]
@@ -27,30 +51,45 @@ Gem::Specification.new do |s|
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<activesupport>, ["= 3.2.0"])
s.add_runtime_dependency(%q<rails>, [">= 0"])
s.add_runtime_dependency(%q<devise>, [">= 0"])
s.add_runtime_dependency(%q<rotp>, [">= 0"])
+ s.add_runtime_dependency(%q<devise_google_authenticator>, [">= 0"])
+ s.add_development_dependency(%q<shoulda>, ["~> 2.11.3"])
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
s.add_development_dependency(%q<shoulda>, ["~> 2.11.3"])
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
- s.add_development_dependency(%q<rcov>, [">= 0"])
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
else
+ s.add_dependency(%q<activesupport>, ["= 3.2.0"])
s.add_dependency(%q<rails>, [">= 0"])
s.add_dependency(%q<devise>, [">= 0"])
s.add_dependency(%q<rotp>, [">= 0"])
+ s.add_dependency(%q<devise_google_authenticator>, [">= 0"])
s.add_dependency(%q<shoulda>, ["~> 2.11.3"])
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
- s.add_dependency(%q<rcov>, [">= 0"])
+ s.add_dependency(%q<shoulda>, ["~> 2.11.3"])
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
+ s.add_dependency(%q<simplecov>, [">= 0"])
end
else
+ s.add_dependency(%q<activesupport>, ["= 3.2.0"])
s.add_dependency(%q<rails>, [">= 0"])
s.add_dependency(%q<devise>, [">= 0"])
s.add_dependency(%q<rotp>, [">= 0"])
+ s.add_dependency(%q<devise_google_authenticator>, [">= 0"])
+ s.add_dependency(%q<shoulda>, ["~> 2.11.3"])
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
s.add_dependency(%q<shoulda>, ["~> 2.11.3"])
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
- s.add_dependency(%q<rcov>, [">= 0"])
+ s.add_dependency(%q<simplecov>, [">= 0"])
end
end
@@ -0,0 +1,13 @@
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..'))
+require 'test_helper'
+require 'rails/generators'
+require 'generators/devise_google_authenticator/devise_google_authenticator_generator'
+
+class GeneratorsTest < ActiveSupport::TestCase
+ RAILS_APP_PATH = File.expand_path("../rails_app", __FILE__)
+
+ test "rails g should include the 3 generators" do
+ @output = `cd #{RAILS_APP_PATH} && rails g`
+ assert @output.match(%r|DeviseInvitable:\n devise_invitable\n devise_invitable:install\n devise_invitable:views|)
+ end
+end
@@ -0,0 +1,4 @@
+ActiveRecord::Migration.verbose = false
+ActiveRecord::Base.logger = Logger.new(nil)
+
+ActiveRecord::Migrator.migrate(File.expand_path("../../rails_app/db/migrate/", __FILE__))
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,9 @@
+// This is a manifest file that'll be compiled into including all the files listed below.
+// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
+// be included in the compiled file accessible from http://example.com/assets/application.js
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,7 @@
+/*
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
+ *= require_self
+ *= require_tree .
+*/
@@ -0,0 +1,3 @@
+// Place all the styles related to the posts controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
Oops, something went wrong. Retry.

0 comments on commit 4af2e61

Please sign in to comment.