summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorankonym <ankonym@gmail.com>2015-09-01 10:48:25 +0200
committerankonym <ankonym@gmail.com>2015-09-28 15:12:45 +0200
commitc48e921c101d49bf68fa1af489b8012517b1a105 (patch)
tree78cc0754a9e24c805e8dc5cf4c2af4e204752af3 /test
parent06ebc254bc4537e81c1336627ba8a54c881a1765 (diff)
Fix several test failures by stubbing invite code validation
Diffstat (limited to 'test')
-rw-r--r--test/functional/identities_controller_test.rb2
-rw-r--r--test/functional/v1/messages_controller_test.rb2
-rw-r--r--test/integration/browser/account_test.rb3
-rw-r--r--test/support/browser_integration_test.rb2
-rw-r--r--test/unit/tmp_user_test.rb2
-rw-r--r--test/unit/token_test.rb2
6 files changed, 8 insertions, 5 deletions
diff --git a/test/functional/identities_controller_test.rb b/test/functional/identities_controller_test.rb
index c900178..e491c52 100644
--- a/test/functional/identities_controller_test.rb
+++ b/test/functional/identities_controller_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class IdentitiesControllerTest < ActionController::TestCase
setup do
- InviteCodeValidator.any_instance.stubs(:not_existent?).returns(false)
+ InviteCodeValidator.any_instance.stubs(:validate)
end
test "admin can list active and blocked ids" do
diff --git a/test/functional/v1/messages_controller_test.rb b/test/functional/v1/messages_controller_test.rb
index 455eebd..720d862 100644
--- a/test/functional/v1/messages_controller_test.rb
+++ b/test/functional/v1/messages_controller_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class V1::MessagesControllerTest < ActionController::TestCase
setup do
- InviteCodeValidator.any_instance.stubs(:not_existent?).returns(false)
+ InviteCodeValidator.any_instance.stubs(:validate)
@user = FactoryGirl.build(:user)
@user.save
@message = Message.new(:text => 'a test message')
diff --git a/test/integration/browser/account_test.rb b/test/integration/browser/account_test.rb
index 34eb72e..6ab9eb2 100644
--- a/test/integration/browser/account_test.rb
+++ b/test/integration/browser/account_test.rb
@@ -47,6 +47,7 @@ class AccountTest < BrowserIntegrationTest
test "account destruction" do
username, password = submit_signup
+
click_on I18n.t('account_settings')
click_on I18n.t('destroy_my_account')
assert page.has_content?(I18n.t('account_destroyed'))
@@ -102,6 +103,8 @@ class AccountTest < BrowserIntegrationTest
# trying to seed an invalid A for srp login
test "detects attempt to circumvent SRP" do
+ InviteCodeValidator.any_instance.stubs(:validate)
+
user = FactoryGirl.create :user
visit '/login'
fill_in 'Username', with: user.login
diff --git a/test/support/browser_integration_test.rb b/test/support/browser_integration_test.rb
index b4bc273..f20421d 100644
--- a/test/support/browser_integration_test.rb
+++ b/test/support/browser_integration_test.rb
@@ -60,7 +60,7 @@ class BrowserIntegrationTest < ActionDispatch::IntegrationTest
# currently this only works for tests with poltergeist.
# ApiIntegrationTest has a working implementation for RackTest
def login(user = nil)
- InviteCodeValidator.any_instance.stubs(:not_existent?).returns(false)
+ InviteCodeValidator.any_instance.stubs(:validate)
@user ||= user ||= FactoryGirl.create(:user)
token = Token.create user_id: user.id
page.driver.add_header "Authorization", %Q(Token token="#{token}")
diff --git a/test/unit/tmp_user_test.rb b/test/unit/tmp_user_test.rb
index 0a9ad68..9494377 100644
--- a/test/unit/tmp_user_test.rb
+++ b/test/unit/tmp_user_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class TmpUserTest < ActiveSupport::TestCase
setup do
- InviteCodeValidator.any_instance.stubs(:not_existent?).returns(false)
+ InviteCodeValidator.any_instance.stubs(:validate)
end
test "test_user saved to tmp_users" do
diff --git a/test/unit/token_test.rb b/test/unit/token_test.rb
index dcf3fc4..51c8d8e 100644
--- a/test/unit/token_test.rb
+++ b/test/unit/token_test.rb
@@ -4,7 +4,7 @@ class TokenTest < ActiveSupport::TestCase
include StubRecordHelper
setup do
- InviteCodeValidator.any_instance.stubs(:not_existent?).returns(false)
+ InviteCodeValidator.any_instance.stubs(:validate)
@user = find_record :user
end