Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed tests

  • Loading branch information...
commit 86edabf65cbff25e4a4b8b7909055f68f70221c4 1 parent 3bf7799
@fesplugas fesplugas authored
View
2  Gemfile
@@ -66,7 +66,7 @@ gem 'mongoid', '~> 2.4.6'
gem 'bson_ext', '~> 1.6.1'
group :test do
- gem 'mocha', '~> 0.12.10', :require => false
+ gem 'mocha', '~> 0.13.3', :require => false
end
gem 'kaminari'
View
4 Gemfile.lock
@@ -104,7 +104,7 @@ GEM
treetop (~> 1.4.8)
metaclass (0.0.1)
mime-types (1.21)
- mocha (0.12.10)
+ mocha (0.13.3)
metaclass (~> 0.0.1)
mongo (1.6.2)
bson (~> 1.6.2)
@@ -200,7 +200,7 @@ DEPENDENCIES
jquery-rails
jruby-openssl
kaminari
- mocha (~> 0.12.10)
+ mocha (~> 0.13.3)
mongoid (~> 2.4.6)
mysql2 (~> 0.3.11)
paperclip (~> 2.7.5)
View
3  test/app/controllers/admin/session_controller_test.rb
@@ -41,6 +41,7 @@ class Admin::SessionControllerTest < ActionController::TestCase
test 'new is rendered when there are users' do
FactoryGirl.create(:typus_user)
+ Typus.mailer_sender = nil
get :new
assert_response :success
@@ -55,6 +56,8 @@ class Admin::SessionControllerTest < ActionController::TestCase
# verify_typus_sign_in_layout_does_not_include_recover_password_link
assert !response.body.include?("Recover password")
+
+ Typus.mailer_sender = 'john@example.com'
end
test "new includes recover_password_link when mailer_sender is set" do
View
7 test/app/mailers/admin/mailer_test.rb
@@ -7,7 +7,7 @@ class Admin::MailerTest < ActiveSupport::TestCase
user = FactoryGirl.build(:typus_user, :token => "qswed3-64g3fb")
mail = Admin::Mailer.reset_password_instructions(user, host)
- assert_nil Admin::Mailer.default[:from]
+ refute mail.from.empty?
assert mail.to.include?(user.email)
expected = "[#{Typus.admin_title}] Reset password"
@@ -18,4 +18,9 @@ class Admin::MailerTest < ActiveSupport::TestCase
assert_match url, mail.body.encoded
end
+ # This is a kind of hack to verify we are properly setting a value.
+ test 'from is set from test.rb' do
+ assert_equal 'john@example.com', Admin::Mailer.default[:from]
+ end
+
end
View
4 test/dummy/config/database.yml
@@ -37,9 +37,13 @@ mysql2: &mysql2
development:
<<: *<%= connection %>
+ username:
+ password:
test:
<<: *<%= connection %>
+ username:
+ password:
production:
<<: *<%= connection %>
View
1  test/dummy/config/environments/test.rb
@@ -43,4 +43,5 @@
config.authentication = :session
config.user_class_name = "TypusUser"
config.user_foreign_key = "typus_user_id"
+ config.mailer_sender = "john@example.com"
end
View
6 test/lib/typus_test.rb
@@ -18,9 +18,9 @@ class TypusTest < ActiveSupport::TestCase
assert Typus.authentication.eql?(:session)
end
- test "default_config for mailer_sender" do
- assert Typus.mailer_sender.nil?
- end
+ # test "default_config for mailer_sender" do
+ # assert Typus.mailer_sender.nil?
+ # end
test "default_config for username" do
assert Typus.username.eql?('admin')
View
2  test/test_helper.rb
@@ -7,7 +7,7 @@
require "rails/test_help"
# require "minitest/pride"
-require "mocha"
+require "mocha/setup"
Rails.backtrace_cleaner.remove_silencers!
Please sign in to comment.
Something went wrong with that request. Please try again.