Merge pull request #6959 from cmrd-senya/devise-upgrade
Upgrade devise to 4.2
This commit is contained in:
commit
7fa299b7ad
52 changed files with 202 additions and 171 deletions
4
Gemfile
4
Gemfile
|
|
@ -23,9 +23,9 @@ gem "json-schema", "2.6.2"
|
||||||
|
|
||||||
# Authentication
|
# Authentication
|
||||||
|
|
||||||
gem "devise", "3.5.6"
|
gem "devise", "4.2.0"
|
||||||
gem "devise_lastseenable", "0.0.6"
|
gem "devise_lastseenable", "0.0.6"
|
||||||
gem "devise-token_authenticatable", "0.4.6"
|
gem "devise-token_authenticatable", "0.5.2"
|
||||||
|
|
||||||
# Captcha
|
# Captcha
|
||||||
|
|
||||||
|
|
|
||||||
13
Gemfile.lock
13
Gemfile.lock
|
|
@ -165,15 +165,14 @@ GEM
|
||||||
railties (>= 3, < 5)
|
railties (>= 3, < 5)
|
||||||
cucumber-wire (0.0.1)
|
cucumber-wire (0.0.1)
|
||||||
database_cleaner (1.5.3)
|
database_cleaner (1.5.3)
|
||||||
devise (3.5.6)
|
devise (4.2.0)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (>= 3.2.6, < 5)
|
railties (>= 4.1.0, < 5.1)
|
||||||
responders
|
responders
|
||||||
thread_safe (~> 0.1)
|
|
||||||
warden (~> 1.2.3)
|
warden (~> 1.2.3)
|
||||||
devise-token_authenticatable (0.4.6)
|
devise-token_authenticatable (0.5.2)
|
||||||
devise (>= 3.5.2, < 4.0.0)
|
devise (>= 4.0.0, < 4.3.0)
|
||||||
devise_lastseenable (0.0.6)
|
devise_lastseenable (0.0.6)
|
||||||
devise
|
devise
|
||||||
rails (>= 3.0.4)
|
rails (>= 3.0.4)
|
||||||
|
|
@ -927,8 +926,8 @@ DEPENDENCIES
|
||||||
cucumber-api-steps (= 0.13)
|
cucumber-api-steps (= 0.13)
|
||||||
cucumber-rails (= 1.4.3)
|
cucumber-rails (= 1.4.3)
|
||||||
database_cleaner (= 1.5.3)
|
database_cleaner (= 1.5.3)
|
||||||
devise (= 3.5.6)
|
devise (= 4.2.0)
|
||||||
devise-token_authenticatable (= 0.4.6)
|
devise-token_authenticatable (= 0.5.2)
|
||||||
devise_lastseenable (= 0.0.6)
|
devise_lastseenable (= 0.0.6)
|
||||||
diaspora-prosody-config (= 0.0.5)
|
diaspora-prosody-config (= 0.0.5)
|
||||||
diaspora_federation-rails (= 0.1.3)
|
diaspora_federation-rails (= 0.1.3)
|
||||||
|
|
|
||||||
|
|
@ -1,88 +1,129 @@
|
||||||
en:
|
en:
|
||||||
errors:
|
|
||||||
messages:
|
|
||||||
not_found: "not found"
|
|
||||||
already_confirmed: "was already confirmed"
|
|
||||||
not_locked: "was not locked"
|
|
||||||
|
|
||||||
devise:
|
devise:
|
||||||
failure:
|
|
||||||
unauthenticated: 'You need to sign in or sign up before continuing.'
|
|
||||||
unconfirmed: 'You have to confirm your account before continuing.'
|
|
||||||
locked: 'Your account is locked.'
|
|
||||||
not_found_in_database: 'Invalid email or password.'
|
|
||||||
invalid: 'Invalid username or password.'
|
|
||||||
invalid_token: 'Invalid authentication token.'
|
|
||||||
timeout: 'Your session expired, please sign in again to continue.'
|
|
||||||
inactive: 'Your account was not activated yet.'
|
|
||||||
sessions:
|
|
||||||
new:
|
|
||||||
login: 'Log in'
|
|
||||||
username: 'Username'
|
|
||||||
password: 'Password'
|
|
||||||
sign_in: 'Sign in'
|
|
||||||
remember_me: "Remember me"
|
|
||||||
modern_browsers: 'only supports modern browsers.'
|
|
||||||
signed_in: 'Signed in successfully.'
|
|
||||||
signed_out: 'Signed out successfully.'
|
|
||||||
passwords:
|
|
||||||
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
|
|
||||||
updated: 'Your password was changed successfully. You are now signed in.'
|
|
||||||
edit:
|
|
||||||
change_password: "Change my password"
|
|
||||||
new_password: "New password"
|
|
||||||
confirm_password: "Confirm password"
|
|
||||||
new:
|
|
||||||
forgot_password: "Forgot your password?"
|
|
||||||
no_account: 'No account with this email exists'
|
|
||||||
reset_password: "Reset password"
|
|
||||||
email: "Email address"
|
|
||||||
send_password_instructions: "Send me reset password instructions"
|
|
||||||
confirmations:
|
confirmations:
|
||||||
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
confirmed: Your email address has been successfully confirmed.
|
||||||
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
send_instructions: You will receive an email with instructions for how to confirm
|
||||||
|
your email address in a few minutes.
|
||||||
|
send_paranoid_instructions: If your email address exists in our database, you
|
||||||
|
will receive an email with instructions for how to confirm your email address
|
||||||
|
in a few minutes.
|
||||||
new:
|
new:
|
||||||
resend_confirmation: "Resend confirmation instructions"
|
resend_confirmation: Resend confirmation instructions
|
||||||
registrations:
|
failure:
|
||||||
signed_up: 'You have signed up successfully. If enabled, a confirmation was sent to your e-mail.'
|
already_authenticated: You are already signed in.
|
||||||
updated: 'You updated your account successfully.'
|
inactive: Your account is not activated yet.
|
||||||
destroyed: 'Bye! Your account was successfully deleted. We hope to see you again soon.'
|
invalid: Invalid %{authentication_keys} or password.
|
||||||
unlocks:
|
locked: Your account is locked.
|
||||||
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
last_attempt: You have one more attempt before your account is locked.
|
||||||
unlocked: 'Your account was successfully unlocked. You are now signed in.'
|
not_found_in_database: Invalid %{authentication_keys} or password.
|
||||||
new:
|
timeout: Your session expired. Please sign in again to continue.
|
||||||
resend_unlock: "Resend unlock instructions"
|
unauthenticated: You need to sign in or sign up before continuing.
|
||||||
invitations:
|
unconfirmed: You have to confirm your email address before continuing.
|
||||||
send_instructions: 'Your invitation has been sent.'
|
invalid_token: Invalid authentication token.
|
||||||
invitation_token_invalid: 'Our apologies! That invitation token is not valid.'
|
|
||||||
updated: 'Your password was set successfully. You are now signed in.'
|
|
||||||
mailer:
|
mailer:
|
||||||
welcome: "Welcome %{email}!"
|
|
||||||
hello: "Hello %{email}!"
|
|
||||||
confirmation_instructions:
|
confirmation_instructions:
|
||||||
subject: 'Confirmation instructions'
|
subject: Confirmation instructions
|
||||||
you_can_confirm: "You can confirm your account through the link below:"
|
you_can_confirm: 'You can confirm your account through the link below:'
|
||||||
confirm: "Confirm my account"
|
confirm: Confirm my account
|
||||||
reset_password_instructions:
|
reset_password_instructions:
|
||||||
subject: 'Reset password instructions'
|
subject: Reset password instructions
|
||||||
someone_requested: "Someone has requested a link to change your password. If it was you, you can do this through the link below."
|
someone_requested: Someone has requested a link to change your password. If
|
||||||
change: "Change my password"
|
it was you, you can do this through the link below.
|
||||||
wont_change: "Your password won't change until you access the link above and create a new one."
|
change: Change my password
|
||||||
ignore: "If you didn't request this, please ignore this email."
|
wont_change: Your password won't change until you access the link above and
|
||||||
|
create a new one.
|
||||||
|
ignore: If you didn't request this, please ignore this email.
|
||||||
unlock_instructions:
|
unlock_instructions:
|
||||||
subject: 'Unlock instructions'
|
subject: Unlock instructions
|
||||||
account_locked: "Your account has been locked due to an excessive number of unsuccessful sign in attempts."
|
account_locked: Your account has been locked due to an excessive number of
|
||||||
click_to_unlock: "Click the link below to unlock your account:"
|
unsuccessful sign in attempts.
|
||||||
unlock: "Unlock my account"
|
click_to_unlock: 'Click the link below to unlock your account:'
|
||||||
|
unlock: Unlock my account
|
||||||
|
password_change:
|
||||||
|
subject: Password Changed
|
||||||
|
welcome: Welcome %{email}!
|
||||||
|
hello: Hello %{email}!
|
||||||
inviter:
|
inviter:
|
||||||
has_invited_you: "%{name}"
|
has_invited_you: "%{name}"
|
||||||
have_invited_you: "%{names} have invited you to join diaspora*"
|
have_invited_you: "%{names} have invited you to join diaspora*"
|
||||||
accept_at: "at %{url}, you can accept it through the link below."
|
accept_at: at %{url}, you can accept it through the link below.
|
||||||
|
omniauth_callbacks:
|
||||||
|
failure: Could not authenticate you from %{kind} because "%{reason}".
|
||||||
|
success: Successfully authenticated from %{kind} account.
|
||||||
|
passwords:
|
||||||
|
no_token: You can't access this page without coming from a password reset email.
|
||||||
|
If you do come from a password reset email, please make sure you used the
|
||||||
|
full URL provided.
|
||||||
|
send_instructions: You will receive an email with instructions on how to reset
|
||||||
|
your password in a few minutes.
|
||||||
|
send_paranoid_instructions: If your email address exists in our database, you
|
||||||
|
will receive a password recovery link at your email address in a few minutes.
|
||||||
|
updated: Your password has been changed successfully. You are now signed in.
|
||||||
|
updated_not_active: Your password has been changed successfully.
|
||||||
|
edit:
|
||||||
|
change_password: Change my password
|
||||||
|
new_password: New password
|
||||||
|
confirm_password: Confirm password
|
||||||
|
new:
|
||||||
|
forgot_password: Forgot your password?
|
||||||
|
no_account: No account with this email exists
|
||||||
|
reset_password: Reset password
|
||||||
|
email: Email address
|
||||||
|
send_password_instructions: Send me reset password instructions
|
||||||
|
registrations:
|
||||||
|
destroyed: Bye! Your account was successfully deleted. We hope to see you again
|
||||||
|
soon.
|
||||||
|
signed_up: You have signed up successfully. If enabled, a confirmation was sent
|
||||||
|
to your e-mail.
|
||||||
|
signed_up_but_inactive: You have signed up successfully. However, we could not
|
||||||
|
sign you in because your account is not yet activated.
|
||||||
|
signed_up_but_locked: You have signed up successfully. However, we could not
|
||||||
|
sign you in because your account is locked.
|
||||||
|
signed_up_but_unconfirmed: A message with a confirmation link has been sent
|
||||||
|
to your email address. Please follow the link to activate your account.
|
||||||
|
update_needs_confirmation: You updated your account successfully, but we need
|
||||||
|
to verify your new email address. Please check your email and follow the confirm
|
||||||
|
link to confirm your new email address.
|
||||||
|
updated: Your account has been updated successfully.
|
||||||
|
sessions:
|
||||||
|
signed_in: Signed in successfully.
|
||||||
|
signed_out: Signed out successfully.
|
||||||
|
already_signed_out: Signed out successfully.
|
||||||
|
new:
|
||||||
|
login: Log in
|
||||||
|
username: Username
|
||||||
|
password: Password
|
||||||
|
sign_in: Sign in
|
||||||
|
remember_me: Remember me
|
||||||
|
modern_browsers: only supports modern browsers.
|
||||||
|
unlocks:
|
||||||
|
send_instructions: You will receive an email with instructions for how to unlock
|
||||||
|
your account in a few minutes.
|
||||||
|
send_paranoid_instructions: If your account exists, you will receive an email
|
||||||
|
with instructions for how to unlock it in a few minutes.
|
||||||
|
unlocked: Your account has been unlocked successfully. Please sign in to continue.
|
||||||
|
new:
|
||||||
|
resend_unlock: Resend unlock instructions
|
||||||
|
invitations:
|
||||||
|
send_instructions: Your invitation has been sent.
|
||||||
|
invitation_token_invalid: Our apologies! That invitation token is not valid.
|
||||||
|
updated: Your password was set successfully. You are now signed in.
|
||||||
shared:
|
shared:
|
||||||
links:
|
links:
|
||||||
sign_in: 'Sign in'
|
sign_in: Sign in
|
||||||
sign_up: 'Create account'
|
sign_up: Create account
|
||||||
sign_up_closed: 'Open signups are closed at this time.'
|
sign_up_closed: Open signups are closed at this time.
|
||||||
forgot_your_password: 'Forgot your password?'
|
forgot_your_password: Forgot your password?
|
||||||
receive_confirmation: "Didn't receive confirmation instructions?"
|
receive_confirmation: Didn't receive confirmation instructions?
|
||||||
receive_unlock: "Didn't receive unlock instructions?"
|
receive_unlock: Didn't receive unlock instructions?
|
||||||
|
errors:
|
||||||
|
messages:
|
||||||
|
already_confirmed: was already confirmed, please try signing in
|
||||||
|
confirmation_period_expired: needs to be confirmed within %{period}, please
|
||||||
|
request a new one
|
||||||
|
expired: has expired, please request a new one
|
||||||
|
not_found: not found
|
||||||
|
not_locked: was not locked
|
||||||
|
not_saved:
|
||||||
|
one: '1 error prohibited this %{resource} from being saved:'
|
||||||
|
other: "%{count} errors prohibited this %{resource} from being saved:"
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ describe Admin::PodsController, type: :controller do
|
||||||
@user = FactoryGirl.create :user
|
@user = FactoryGirl.create :user
|
||||||
Role.add_admin(@user.person)
|
Role.add_admin(@user.person)
|
||||||
|
|
||||||
sign_in :user, @user
|
sign_in @user, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#index" do
|
describe "#index" do
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ describe Admin::UsersController, :type => :controller do
|
||||||
@user = FactoryGirl.create :user
|
@user = FactoryGirl.create :user
|
||||||
Role.add_admin(@user.person)
|
Role.add_admin(@user.person)
|
||||||
|
|
||||||
sign_in :user, @user
|
sign_in @user, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#close_account' do
|
describe '#close_account' do
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require 'spec_helper'
|
||||||
describe AdminsController, :type => :controller do
|
describe AdminsController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
@user = FactoryGirl.create :user
|
@user = FactoryGirl.create :user
|
||||||
sign_in :user, @user
|
sign_in @user, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#user_search' do
|
describe '#user_search' do
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ describe Api::OpenidConnect::AuthorizationsController, type: :controller do
|
||||||
let!(:client_with_multiple_redirects) { FactoryGirl.create(:o_auth_application_with_multiple_redirects) }
|
let!(:client_with_multiple_redirects) { FactoryGirl.create(:o_auth_application_with_multiple_redirects) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#new" do
|
describe "#new" do
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ describe Api::OpenidConnect::UserApplicationsController, type: :controller do
|
||||||
@app = FactoryGirl.create(:o_auth_application_with_xss)
|
@app = FactoryGirl.create(:o_auth_application_with_xss)
|
||||||
@user = FactoryGirl.create :user
|
@user = FactoryGirl.create :user
|
||||||
FactoryGirl.create :auth_with_read, user: @user, o_auth_application: @app
|
FactoryGirl.create :auth_with_read, user: @user, o_auth_application: @app
|
||||||
sign_in :user, @user
|
sign_in @user, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when try to XSS" do
|
context "when try to XSS" do
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ describe AspectMembershipsController, type: :controller do
|
||||||
@contact = alice.contact_for(bob.person)
|
@contact = alice.contact_for(bob.person)
|
||||||
alice.getting_started = false
|
alice.getting_started = false
|
||||||
alice.save
|
alice.save
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
allow(@controller).to receive(:current_user).and_return(alice)
|
allow(@controller).to receive(:current_user).and_return(alice)
|
||||||
request.env["HTTP_REFERER"] = "http://" + request.host
|
request.env["HTTP_REFERER"] = "http://" + request.host
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ describe AspectsController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
alice.getting_started = false
|
alice.getting_started = false
|
||||||
alice.save
|
alice.save
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
@alices_aspect_1 = alice.aspects.where(:name => "generic").first
|
@alices_aspect_1 = alice.aspects.where(:name => "generic").first
|
||||||
@alices_aspect_2 = alice.aspects.create(:name => "another aspect")
|
@alices_aspect_2 = alice.aspects.create(:name => "another aspect")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require 'spec_helper'
|
||||||
describe CommentsController, :type => :controller do
|
describe CommentsController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
allow(@controller).to receive(:current_user).and_return(alice)
|
allow(@controller).to receive(:current_user).and_return(alice)
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#create' do
|
describe '#create' do
|
||||||
|
|
@ -79,7 +79,7 @@ describe CommentsController, :type => :controller do
|
||||||
context 'your post' do
|
context 'your post' do
|
||||||
before do
|
before do
|
||||||
allow(@controller).to receive(:current_user).and_return(bob)
|
allow(@controller).to receive(:current_user).and_return(bob)
|
||||||
sign_in :user, bob
|
sign_in bob, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'lets the user delete his comment' do
|
it 'lets the user delete his comment' do
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe ContactsController, :type => :controller do
|
describe ContactsController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
sign_in :user, bob
|
sign_in bob, scope: :user
|
||||||
allow(@controller).to receive(:current_user).and_return(bob)
|
allow(@controller).to receive(:current_user).and_return(bob)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require 'spec_helper'
|
||||||
describe ConversationVisibilitiesController, :type => :controller do
|
describe ConversationVisibilitiesController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
@user1 = alice
|
@user1 = alice
|
||||||
sign_in :user, @user1
|
sign_in @user1, scope: :user
|
||||||
|
|
||||||
hash = {
|
hash = {
|
||||||
:author => @user1.person,
|
:author => @user1.person,
|
||||||
|
|
@ -27,7 +27,7 @@ describe ConversationVisibilitiesController, :type => :controller do
|
||||||
|
|
||||||
it 'does not let a user destroy a visibility that is not theirs' do
|
it 'does not let a user destroy a visibility that is not theirs' do
|
||||||
user2 = eve
|
user2 = eve
|
||||||
sign_in :user, user2
|
sign_in user2, scope: :user
|
||||||
|
|
||||||
expect {
|
expect {
|
||||||
delete :destroy, :conversation_id => @conversation.id
|
delete :destroy, :conversation_id => @conversation.id
|
||||||
|
|
@ -42,7 +42,7 @@ describe ConversationVisibilitiesController, :type => :controller do
|
||||||
it 'returns "deleted" when last participant' do
|
it 'returns "deleted" when last participant' do
|
||||||
get :destroy, :conversation_id => @conversation.id
|
get :destroy, :conversation_id => @conversation.id
|
||||||
sign_out :user
|
sign_out :user
|
||||||
sign_in :user, bob
|
sign_in bob, scope: :user
|
||||||
get :destroy, :conversation_id => @conversation.id
|
get :destroy, :conversation_id => @conversation.id
|
||||||
expect(flash.notice).to include("deleted")
|
expect(flash.notice).to include("deleted")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe ConversationsController, :type => :controller do
|
describe ConversationsController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#new' do
|
describe '#new' do
|
||||||
|
|
@ -98,7 +98,7 @@ describe ConversationsController, :type => :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not let you access conversations where you are not a recipient" do
|
it "does not let you access conversations where you are not a recipient" do
|
||||||
sign_in :user, eve
|
sign_in eve, scope: :user
|
||||||
get :index, conversation_id: @conversations.first.id
|
get :index, conversation_id: @conversations.first.id
|
||||||
expect(assigns[:conversation]).to be_nil
|
expect(assigns[:conversation]).to be_nil
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ describe InvitationsController, :type => :controller do
|
||||||
|
|
||||||
describe "#create" do
|
describe "#create" do
|
||||||
before do
|
before do
|
||||||
sign_in :user, @user
|
sign_in @user, scope: :user
|
||||||
allow(@controller).to receive(:current_user).and_return(@user)
|
allow(@controller).to receive(:current_user).and_return(@user)
|
||||||
@referer = 'http://test.host/cats/foo'
|
@referer = 'http://test.host/cats/foo'
|
||||||
request.env["HTTP_REFERER"] = @referer
|
request.env["HTTP_REFERER"] = @referer
|
||||||
|
|
@ -159,7 +159,7 @@ describe InvitationsController, :type => :controller do
|
||||||
|
|
||||||
describe '#new' do
|
describe '#new' do
|
||||||
it 'renders' do
|
it 'renders' do
|
||||||
sign_in :user, @user
|
sign_in @user, scope: :user
|
||||||
get :new
|
get :new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ describe AdminsController, type: :controller do
|
||||||
before do
|
before do
|
||||||
@user = FactoryGirl.create :user
|
@user = FactoryGirl.create :user
|
||||||
Role.add_admin(@user.person)
|
Role.add_admin(@user.person)
|
||||||
sign_in :user, @user
|
sign_in @user, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
context "jasmine fixtures" do
|
context "jasmine fixtures" do
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require 'spec_helper'
|
||||||
describe StreamsController, :type => :controller do
|
describe StreamsController, :type => :controller do
|
||||||
describe '#aspects' do
|
describe '#aspects' do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
@alices_aspect_2 = alice.aspects.create(:name => "another aspect")
|
@alices_aspect_2 = alice.aspects.create(:name => "another aspect")
|
||||||
|
|
||||||
request.env["HTTP_REFERER"] = 'http://' + request.host
|
request.env["HTTP_REFERER"] = 'http://' + request.host
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ describe ContactsController, :type => :controller do
|
||||||
@aspect = bob.aspects.create(:name => "another aspect")
|
@aspect = bob.aspects.create(:name => "another aspect")
|
||||||
bob.share_with alice.person, @aspect
|
bob.share_with alice.person, @aspect
|
||||||
bob.share_with eve.person, @aspect
|
bob.share_with eve.person, @aspect
|
||||||
sign_in :user, bob
|
sign_in bob, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "generates the aspects_manage fixture", :fixture => true do
|
it "generates the aspects_manage fixture", :fixture => true do
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ describe ConversationsController, :type => :controller do
|
||||||
Message.create(:author => @person, :created_at => Time.now + 100, :text => "message", :conversation_id => @conv2.id)
|
Message.create(:author => @person, :created_at => Time.now + 100, :text => "message", :conversation_id => @conv2.id)
|
||||||
.increase_unread(alice)
|
.increase_unread(alice)
|
||||||
|
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "generates a jasmine fixture", :fixture => true do
|
it "generates a jasmine fixture", :fixture => true do
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||||
describe NotificationsController, :type => :controller do
|
describe NotificationsController, :type => :controller do
|
||||||
describe '#index' do
|
describe '#index' do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
@post = FactoryGirl.create(:status_message)
|
@post = FactoryGirl.create(:status_message)
|
||||||
FactoryGirl.create(:notification, :recipient => alice, :target => @post)
|
FactoryGirl.create(:notification, :recipient => alice, :target => @post)
|
||||||
get :read_all
|
get :read_all
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require 'spec_helper'
|
||||||
describe PeopleController, :type => :controller do
|
describe PeopleController, :type => :controller do
|
||||||
describe '#index' do
|
describe '#index' do
|
||||||
before do
|
before do
|
||||||
sign_in :user, bob
|
sign_in bob, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "generates a jasmine fixture with no query", :fixture => true do
|
it "generates a jasmine fixture with no query", :fixture => true do
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require 'spec_helper'
|
||||||
describe PhotosController, :type => :controller do
|
describe PhotosController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
@alices_photo = alice.post(:photo, :user_file => uploaded_photo, :to => alice.aspects.first.id, :public => false)
|
@alices_photo = alice.post(:photo, :user_file => uploaded_photo, :to => alice.aspects.first.id, :public => false)
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#index' do
|
describe '#index' do
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require 'spec_helper'
|
||||||
describe StatusMessagesController, :type => :controller do
|
describe StatusMessagesController, :type => :controller do
|
||||||
describe '#bookmarklet' do
|
describe '#bookmarklet' do
|
||||||
before do
|
before do
|
||||||
sign_in :user, bob
|
sign_in bob, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "generates a jasmine fixture", :fixture => true do
|
it "generates a jasmine fixture", :fixture => true do
|
||||||
|
|
@ -19,7 +19,7 @@ describe StatusMessagesController, :type => :controller do
|
||||||
|
|
||||||
describe '#new' do
|
describe '#new' do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'generates a jasmine fixture', :fixture => true do
|
it 'generates a jasmine fixture', :fixture => true do
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require 'spec_helper'
|
||||||
describe StreamsController, :type => :controller do
|
describe StreamsController, :type => :controller do
|
||||||
describe '#multi' do
|
describe '#multi' do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'generates the stream_json fixture', :fixture => true do
|
it 'generates the stream_json fixture', :fixture => true do
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ require "spec_helper"
|
||||||
|
|
||||||
describe UsersController, type: :controller do
|
describe UsersController, type: :controller do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#getting_started" do
|
describe "#getting_started" do
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ describe LikesController, :type => :controller do
|
||||||
@alices_aspect = alice.aspects.where(:name => "generic").first
|
@alices_aspect = alice.aspects.where(:name => "generic").first
|
||||||
@bobs_aspect = bob.aspects.where(:name => "generic").first
|
@bobs_aspect = bob.aspects.where(:name => "generic").first
|
||||||
|
|
||||||
sign_in :user, alice
|
sign_in(alice, scope: :user)
|
||||||
end
|
end
|
||||||
|
|
||||||
[Comment, Post].each do |class_const|
|
[Comment, Post].each do |class_const|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe MessagesController, :type => :controller do
|
describe MessagesController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in(alice, scope: :user)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#create' do
|
describe '#create' do
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe NotificationsController, :type => :controller do
|
describe NotificationsController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#update' do
|
describe '#update' do
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||||
describe ParticipationsController, :type => :controller do
|
describe ParticipationsController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
allow(@controller).to receive(:current_user).and_return(alice)
|
allow(@controller).to receive(:current_user).and_return(alice)
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#create' do
|
describe '#create' do
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@
|
||||||
require "spec_helper"
|
require "spec_helper"
|
||||||
|
|
||||||
describe Devise::PasswordsController, type: :controller do
|
describe Devise::PasswordsController, type: :controller do
|
||||||
include Devise::TestHelpers
|
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ describe PeopleController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
@user = alice
|
@user = alice
|
||||||
@aspect = @user.aspects.first
|
@aspect = @user.aspects.first
|
||||||
sign_in :user, @user
|
sign_in @user, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#index (search)' do
|
describe '#index (search)' do
|
||||||
|
|
@ -315,7 +315,7 @@ describe PeopleController, :type => :controller do
|
||||||
context "when the user is following the person" do
|
context "when the user is following the person" do
|
||||||
before do
|
before do
|
||||||
sign_out :user
|
sign_out :user
|
||||||
sign_in :user, peter
|
sign_in peter, scope: :user
|
||||||
@person = alice.person
|
@person = alice.person
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ describe PhotosController, :type => :controller do
|
||||||
@alices_photo = alice.post(:photo, :user_file => uploaded_photo, :to => alice.aspects.first.id, :public => false)
|
@alices_photo = alice.post(:photo, :user_file => uploaded_photo, :to => alice.aspects.first.id, :public => false)
|
||||||
@bobs_photo = bob.post(:photo, :user_file => uploaded_photo, :to => bob.aspects.first.id, :public => true)
|
@bobs_photo = bob.post(:photo, :user_file => uploaded_photo, :to => bob.aspects.first.id, :public => true)
|
||||||
|
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
request.env["HTTP_REFERER"] = ''
|
request.env["HTTP_REFERER"] = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ describe PostsController, type: :controller do
|
||||||
context "user signed in" do
|
context "user signed in" do
|
||||||
context "given a post that the user is allowed to see" do
|
context "given a post that the user is allowed to see" do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "succeeds" do
|
it "succeeds" do
|
||||||
|
|
@ -50,7 +50,7 @@ describe PostsController, type: :controller do
|
||||||
|
|
||||||
context "given a post that the user is not allowed to see" do
|
context "given a post that the user is not allowed to see" do
|
||||||
before do
|
before do
|
||||||
sign_in :user, eve
|
sign_in eve, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns a 404" do
|
it "returns a 404" do
|
||||||
|
|
@ -128,7 +128,7 @@ describe PostsController, type: :controller do
|
||||||
|
|
||||||
context "post of another user" do
|
context "post of another user" do
|
||||||
it "will respond with a 403" do
|
it "will respond with a 403" do
|
||||||
sign_in :user, bob
|
sign_in bob, scope: :user
|
||||||
|
|
||||||
delete :destroy, format: :json, id: post.id
|
delete :destroy, format: :json, id: post.id
|
||||||
expect(response.body).to eq("You are not allowed to do that")
|
expect(response.body).to eq("You are not allowed to do that")
|
||||||
|
|
@ -136,7 +136,7 @@ describe PostsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "will respond with a 404 if the post is not visible" do
|
it "will respond with a 404 if the post is not visible" do
|
||||||
sign_in :user, eve
|
sign_in eve, scope: :user
|
||||||
|
|
||||||
expect {
|
expect {
|
||||||
delete :destroy, format: :json, id: post.id
|
delete :destroy, format: :json, id: post.id
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe ProfilesController, :type => :controller do
|
describe ProfilesController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
sign_in :user, eve
|
sign_in eve, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#show' do
|
describe '#show' do
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe RegistrationsController, :type => :controller do
|
describe RegistrationsController, type: :controller do
|
||||||
include Devise::TestHelpers
|
|
||||||
|
|
||||||
before do
|
before do
|
||||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
@valid_params = {:user => {
|
@valid_params = {:user => {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ describe ResharesController, :type => :controller do
|
||||||
|
|
||||||
context 'with an authenticated user' do
|
context 'with an authenticated user' do
|
||||||
before do
|
before do
|
||||||
sign_in :user, bob
|
sign_in(bob, scope: :user)
|
||||||
allow(@controller).to receive(:current_user).and_return(bob)
|
allow(@controller).to receive(:current_user).and_return(bob)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ describe SearchController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
@user = alice
|
@user = alice
|
||||||
@aspect = @user.aspects.first
|
@aspect = @user.aspects.first
|
||||||
sign_in :user, @user
|
sign_in @user, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'query is a person' do
|
describe 'query is a person' do
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ describe ServicesController, :type => :controller do
|
||||||
let(:user) { alice }
|
let(:user) { alice }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in :user, user
|
sign_in user, scope: :user
|
||||||
allow(@controller).to receive(:current_user).and_return(user)
|
allow(@controller).to receive(:current_user).and_return(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -75,7 +75,7 @@ describe ServicesController, :type => :controller do
|
||||||
context 'when the access-level is read-only' do
|
context 'when the access-level is read-only' do
|
||||||
|
|
||||||
let(:header) { { 'x-access-level' => 'read' } }
|
let(:header) { { 'x-access-level' => 'read' } }
|
||||||
let(:access_token) { double('access_token') }
|
let(:access_token) { double("access_token") }
|
||||||
let(:extra) { {'extra' => { 'access_token' => access_token }} }
|
let(:extra) { {'extra' => { 'access_token' => access_token }} }
|
||||||
let(:provider) { {'provider' => 'twitter'} }
|
let(:provider) { {'provider' => 'twitter'} }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@
|
||||||
require "spec_helper"
|
require "spec_helper"
|
||||||
|
|
||||||
describe SessionsController, type: :controller do
|
describe SessionsController, type: :controller do
|
||||||
include Devise::TestHelpers
|
|
||||||
|
|
||||||
let(:mock_access_token) { Object.new }
|
let(:mock_access_token) { Object.new }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
@ -34,7 +32,7 @@ describe SessionsController, type: :controller do
|
||||||
|
|
||||||
describe "#destroy" do
|
describe "#destroy" do
|
||||||
before do
|
before do
|
||||||
sign_in :user, @user
|
sign_in @user, scope: :user
|
||||||
end
|
end
|
||||||
it "redirects to / for a non-mobile user" do
|
it "redirects to / for a non-mobile user" do
|
||||||
delete :destroy
|
delete :destroy
|
||||||
|
|
@ -51,7 +49,7 @@ describe SessionsController, type: :controller do
|
||||||
describe "#reset_authentication_token" do
|
describe "#reset_authentication_token" do
|
||||||
context "for a logged in user" do
|
context "for a logged in user" do
|
||||||
before do
|
before do
|
||||||
sign_in :user, @user
|
sign_in @user, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "succeeds" do
|
it "succeeds" do
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require 'spec_helper'
|
||||||
describe ShareVisibilitiesController, :type => :controller do
|
describe ShareVisibilitiesController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
@status = alice.post(:status_message, :text => "hello", :to => alice.aspects.first)
|
@status = alice.post(:status_message, :text => "hello", :to => alice.aspects.first)
|
||||||
sign_in :user, bob
|
sign_in(bob, scope: :user)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#update' do
|
describe '#update' do
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ describe StatusMessagesController, :type => :controller do
|
||||||
@aspect1 = alice.aspects.first
|
@aspect1 = alice.aspects.first
|
||||||
|
|
||||||
request.env["HTTP_REFERER"] = ""
|
request.env["HTTP_REFERER"] = ""
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
allow(@controller).to receive(:current_user).and_return(alice)
|
allow(@controller).to receive(:current_user).and_return(alice)
|
||||||
alice.reload
|
alice.reload
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ describe TagFollowingsController, type: :controller do
|
||||||
end
|
end
|
||||||
context "signed in" do
|
context "signed in" do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects html requests" do
|
it "redirects html requests" do
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require 'spec_helper'
|
||||||
describe TagsController, :type => :controller do
|
describe TagsController, :type => :controller do
|
||||||
describe '#index (search)' do
|
describe '#index (search)' do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
bob.profile.tag_string = "#cats #diaspora #rad"
|
bob.profile.tag_string = "#cats #diaspora #rad"
|
||||||
bob.profile.build_tags
|
bob.profile.build_tags
|
||||||
bob.profile.save!
|
bob.profile.save!
|
||||||
|
|
@ -38,7 +38,7 @@ describe TagsController, :type => :controller do
|
||||||
describe '#show' do
|
describe '#show' do
|
||||||
context 'tag with capital letters' do
|
context 'tag with capital letters' do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirect to the downcase tag uri' do
|
it 'redirect to the downcase tag uri' do
|
||||||
|
|
@ -67,7 +67,7 @@ describe TagsController, :type => :controller do
|
||||||
|
|
||||||
context 'signed in' do
|
context 'signed in' do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in alice, scope: :user
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'assigns a Stream::Tag object with the current_user' do
|
it 'assigns a Stream::Tag object with the current_user' do
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ describe UsersController, :type => :controller do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@user = alice
|
@user = alice
|
||||||
sign_in :user, @user
|
sign_in @user, scope: :user
|
||||||
allow(@controller).to receive(:current_user).and_return(@user)
|
allow(@controller).to receive(:current_user).and_return(@user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -181,7 +181,7 @@ describe UsersController, :type => :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'informs the user about failure' do
|
it 'informs the user about failure' do
|
||||||
put(:update, :id => @user.id, :user => { :email => "my@newemailcom"})
|
put(:update, id: @user.id, user: {email: "mynewemailcom"})
|
||||||
expect(request.flash[:error]).to eql(I18n.t('users.update.unconfirmed_email_not_changed'))
|
expect(request.flash[:error]).to eql(I18n.t('users.update.unconfirmed_email_not_changed'))
|
||||||
expect(request.flash[:notice]).to be_blank
|
expect(request.flash[:notice]).to be_blank
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe InterimStreamHackinessHelper, :type => :helper do
|
describe InterimStreamHackinessHelper, type: :helper do
|
||||||
describe 'commenting_disabled?' do
|
describe "commenting_disabled?" do
|
||||||
include Devise::TestHelpers
|
include Devise::Test::ControllerHelpers
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in alice
|
sign_in alice
|
||||||
def user_signed_in?
|
def user_signed_in?
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
require "spec_helper"
|
require "spec_helper"
|
||||||
|
|
||||||
describe UsersHelper, :type => :helper do
|
describe UsersHelper, type: :helper do
|
||||||
include Devise::TestHelpers
|
include Devise::Test::ControllerHelpers
|
||||||
|
|
||||||
describe "#current_color_theme" do
|
describe "#current_color_theme" do
|
||||||
describe "if user is not signed in" do
|
describe "if user is not signed in" do
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
require "spec_helper"
|
require "spec_helper"
|
||||||
require "requests_helper"
|
|
||||||
|
|
||||||
module MentioningSpecHelpers
|
module MentioningSpecHelpers
|
||||||
def default_aspect
|
def default_aspect
|
||||||
|
|
@ -35,7 +34,7 @@ describe "mentioning", type: :request do
|
||||||
@user3 = FactoryGirl.create :user
|
@user3 = FactoryGirl.create :user
|
||||||
|
|
||||||
@user1.share_with(@user2.person, default_aspect)
|
@user1.share_with(@user2.person, default_aspect)
|
||||||
login @user1
|
sign_in @user1
|
||||||
end
|
end
|
||||||
|
|
||||||
# see: https://github.com/diaspora/diaspora/issues/4160
|
# see: https://github.com/diaspora/diaspora/issues/4160
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
require "spec_helper"
|
require "spec_helper"
|
||||||
require "requests_helper"
|
|
||||||
|
|
||||||
describe PeopleController, type: :request do
|
describe PeopleController, type: :request do
|
||||||
context "for the current user" do
|
context "for the current user" do
|
||||||
before do
|
before do
|
||||||
login alice
|
sign_in alice
|
||||||
end
|
end
|
||||||
|
|
||||||
it "displays the publisher for user profile path" do
|
it "displays the publisher for user profile path" do
|
||||||
|
|
@ -37,7 +36,7 @@ describe PeopleController, type: :request do
|
||||||
|
|
||||||
context "for another user" do
|
context "for another user" do
|
||||||
before do
|
before do
|
||||||
login bob
|
sign_in bob
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't display the publisher for user profile path" do
|
it "doesn't display the publisher for user profile path" do
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,12 @@ require 'spec_helper'
|
||||||
describe "i18n interpolation fallbacks" do
|
describe "i18n interpolation fallbacks" do
|
||||||
describe "when string does not require interpolation arguments" do
|
describe "when string does not require interpolation arguments" do
|
||||||
it "works normally" do
|
it "works normally" do
|
||||||
expect(I18n.t('user.invalid',
|
expect(
|
||||||
:resource_name => "user",
|
I18n.t("user.already_authenticated",
|
||||||
:scope => "devise.failure",
|
resource_name: "user",
|
||||||
:default => [:invalid, "invalid"])).to eq("Invalid username or password.")
|
scope: "devise.failure",
|
||||||
|
default: [:already_authenticated, "already_authenticated"])
|
||||||
|
).to eq("You are already signed in.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
describe "when string requires interpolation arguments" do
|
describe "when string requires interpolation arguments" do
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ describe User, :type => :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "requires a valid email address" do
|
it "requires a valid email address" do
|
||||||
alice.email = "somebody@anywhere"
|
alice.email = "somebodyanywhere"
|
||||||
expect(alice).not_to be_valid
|
expect(alice).not_to be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -334,7 +334,7 @@ describe User, :type => :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "requires a valid unconfirmed_email address" do
|
it "requires a valid unconfirmed_email address" do
|
||||||
alice.unconfirmed_email = "somebody@anywhere"
|
alice.unconfirmed_email = "somebodyanywhere"
|
||||||
expect(alice).not_to be_valid
|
expect(alice).not_to be_valid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
include Warden::Test::Helpers
|
|
||||||
|
|
||||||
def login(user)
|
|
||||||
login_as user, scope: :user
|
|
||||||
end
|
|
||||||
|
|
@ -93,7 +93,8 @@ support_files.each {|f| require f }
|
||||||
require fixture_builder_file
|
require fixture_builder_file
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.include Devise::TestHelpers, :type => :controller
|
config.include Devise::Test::ControllerHelpers, type: :controller
|
||||||
|
config.include Devise::Test::IntegrationHelpers, type: :request
|
||||||
config.mock_with :rspec
|
config.mock_with :rspec
|
||||||
|
|
||||||
config.example_status_persistence_file_path = "tmp/rspec-persistance.txt"
|
config.example_status_persistence_file_path = "tmp/rspec-persistance.txt"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue