Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changes to get tests running

  • Loading branch information...
commit f5760f5edf992110914393f2a87ba255af5964fd 1 parent 1fbe207
@bmarini bmarini authored
View
19 Gemfile
@@ -1,17 +1,15 @@
source :rubygems
-source 'http://gems.github.com/'
-
-gem "rails"
group :test do
gem "test-unit", "~> 2.0.9"
- gem "webrat", "~> 0.7.0"
+ gem "webrat", "~> 0.7.2"
gem "mocha", "~> 0.9.8", :require => false
end
group :default do
- gem "webrat", "~> 0.7.0"
+ gem "rails", "~> 3.0.7"
+ gem "webrat", "~> 0.7.2"
gem "bcrypt-ruby", :require => "bcrypt"
gem "oauth2"
@@ -22,10 +20,15 @@ group :default do
gem 'rails3-generators', '>= 0.13.0'
gem 'jnunemaker-validatable', '~> 1.8.1'
gem 'bson_ext', '>= 1.0.9'
-
+
+ gem 'rake', '0.8.7'
gem "orm_adapter"
- gem "omniauth"
-
+ gem "oa-oauth", '~> 0.2.0', :require => "omniauth/oauth"
+ gem "oa-openid", '~> 0.2.0', :require => "omniauth/openid"
+
+ platforms :mri_18 do
+ gem "SystemTimer"
+ end
end
View
58 Rakefile
@@ -4,14 +4,11 @@ require 'rake'
require 'bundler'
Bundler::GemHelper.install_tasks
-
require 'rake/testtask'
require 'rake/rdoctask'
require File.join(File.dirname(__FILE__), 'lib', 'mm-devise', 'version')
desc 'Run Devise tests using MongoMapper. Specify path to devise with DEVISE_PATH'
-
-
Rake::TestTask.new(:test) do |test|
ENV['DEVISE_ORM'] ||= 'mongo_mapper'
ENV['DEVISE_PATH'] ||= File.join(File.dirname(__FILE__), '../devise')
@@ -27,56 +24,5 @@ Rake::TestTask.new(:test) do |test|
test.verbose = true
end
-desc 'Default: run tests for all ORMs.'
-task :default => :tests
-
-=begin
-desc 'Default: run tests for all MongoMapper ORM setups.'
-task :default => :pre_commit
-
-desc 'Run Devise tests for all MongoMapper ORM setups.'
-task :pre_commit do
- Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file|
- orm = File.basename(file).split(".").first
- ENV['DEVISE_PATH'] ||= File.expand_path('../devise')
- system "rake test DEVISE_ORM=#{orm} DEVISE_PATH=#{ENV['DEVISE_PATH']}"
- end
-end
-
-
-task :test
-
-desc 'Generate documentation for dm-devise.'
-Rake::RDocTask.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'mm-devise #{version}'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README.rdoc')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
-
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = "mm-devise"
- gem.version = MongoMapper::Devise::VERSION.dup
- gem.summary = %Q{Support for using MongoMapper ORM with devise}
- gem.description = %Q{dm-devise adds MongoMapper support to devise (http://github.com/plataformatec/devise) for authentication support for Rails}
- gem.email = "jmorgan@morgancreative.net"
- gem.homepage = "http://github.com/kristianmandrup/mm-devise"
- gem.authors = ["Kristian Mandrup"]
- gem.add_dependency 'mongo_mapper', '>= 0.8.4'
- gem.add_dependency 'bson', '>= 1.0.9'
- gem.add_dependency 'rails3-generators', '>= 0.13.0'
- gem.add_dependency 'jnunemaker-validatable', '>= 1.8.1'
- gem.add_dependency 'devise', '>= 1.1.1'
- gem.add_dependency 'sugar-high', '~> 0.3.0'
- gem.add_dependency 'warden', '>= 0.10.7'
- gem.add_dependency 'bcrypt-ruby', '>= 2.1.2'
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
- end
- Jeweler::GemcutterTasks.new
-rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
-end
-=end
+desc 'Default: run tests for MongoMapper'
+task :default => :test
View
92 test/overrides/mm_validations_test.rb
@@ -1,46 +1,46 @@
-require 'test_helper'
-
-# See data_mapper_test.rb in this folder for what this file is doing.
-if DEVISE_ORM == :mongo_mapper
-
- class ValidatableTest < ActiveSupport::TestCase
- undef test_should_require_a_password_with_minimum_of_6_characters
-
- # DataMapper uses a :value_between error message when given a minimum and
- # maximum; ActiveModel shows either the :too_long or :too_short message.
- test 'should require a password with minimum of 6 characters' do
- user = new_user(:password => '12345', :password_confirmation => '12345')
- assert user.invalid?
- # assert_equal 'is too short (minimum is 6 characters)', user.errors[:password].join
- assert_equal 'must be between 6 and 20 characters long', user.errors[:password].join
- end
-
- undef test_should_require_a_password_with_maximum_of_20_characters_long
-
- # Same issue as previous test
- test 'should require a password with maximum of 20 characters long' do
- user = new_user(:password => 'x'*21, :password_confirmation => 'x'*21)
- assert user.invalid?
- # assert_equal 'is too long (maximum is 20 characters)', user.errors[:password].join
- assert_equal 'must be between 6 and 20 characters long', user.errors[:password].join
- end
-
- end
-
- class AuthenticationOthersTest < ActionController::IntegrationTest
-
- undef test_registration_in_xml_format_works_when_recognizing_path
-
- # DM's validates_confirmation_of requires the confirmation field to be present,
- # while ActiveModel by default skips the confirmation test if the confirmation
- # value is nil. This test takes advantage of AM's behavior, so just add the
- # :password_confirmation value.
- test 'registration in xml format works when recognizing path' do
- assert_nothing_raised do
- # post user_registration_path(:format => 'xml', :user => {:email => "test@example.com", :password => "invalid"} )
- post user_registration_path(:format => 'xml', :user => {:email => "test@example.com", :password => "invalid", :password_confirmation => "invalid"} )
- end
- end
- end
-
-end
+# require 'test_helper'
+#
+# # See data_mapper_test.rb in this folder for what this file is doing.
+# if DEVISE_ORM == :mongo_mapper
+#
+# class ValidatableTest < ActiveSupport::TestCase
+# undef test_should_require_a_password_with_minimum_of_6_characters
+#
+# # DataMapper uses a :value_between error message when given a minimum and
+# # maximum; ActiveModel shows either the :too_long or :too_short message.
+# test 'should require a password with minimum of 6 characters' do
+# user = new_user(:password => '12345', :password_confirmation => '12345')
+# assert user.invalid?
+# # assert_equal 'is too short (minimum is 6 characters)', user.errors[:password].join
+# assert_equal 'must be between 6 and 20 characters long', user.errors[:password].join
+# end
+#
+# undef test_should_require_a_password_with_maximum_of_20_characters_long
+#
+# # Same issue as previous test
+# test 'should require a password with maximum of 20 characters long' do
+# user = new_user(:password => 'x'*21, :password_confirmation => 'x'*21)
+# assert user.invalid?
+# # assert_equal 'is too long (maximum is 20 characters)', user.errors[:password].join
+# assert_equal 'must be between 6 and 20 characters long', user.errors[:password].join
+# end
+#
+# end
+#
+# class AuthenticationOthersTest < ActionController::IntegrationTest
+#
+# undef test_registration_in_xml_format_works_when_recognizing_path
+#
+# # DM's validates_confirmation_of requires the confirmation field to be present,
+# # while ActiveModel by default skips the confirmation test if the confirmation
+# # value is nil. This test takes advantage of AM's behavior, so just add the
+# # :password_confirmation value.
+# test 'registration in xml format works when recognizing path' do
+# assert_nothing_raised do
+# # post user_registration_path(:format => 'xml', :user => {:email => "test@example.com", :password => "invalid"} )
+# post user_registration_path(:format => 'xml', :user => {:email => "test@example.com", :password => "invalid", :password_confirmation => "invalid"} )
+# end
+# end
+# end
+#
+# end
View
8 test/test_helper.rb
@@ -12,8 +12,9 @@
MongoMapper.database = 'mm-devise-db'
I18n.load_path << "#{DEVISE_PATH}/test/support/locale/en.yml"
-require 'mocha'
+require 'mocha'
+require 'webrat'
Webrat.configure do |config|
config.mode = :rails
config.open_error_files = false
@@ -24,3 +25,8 @@
# Add support to load paths so we can overwrite broken webrat setup
$:.unshift "#{DEVISE_PATH}/test/support"
Dir["#{DEVISE_PATH}/test/support/**/*.rb"].each { |f| require f }
+
+# For generators
+require "rails/generators/test_case"
+require "generators/devise/install_generator"
+require "generators/devise/views_generator"

0 comments on commit f5760f5

Please sign in to comment.
Something went wrong with that request. Please try again.