spec: don't show "change password" menu entry

pull/1620/head
Markus Kahl 10 years ago
parent 873136d6ee
commit 21bf768ce1
  1. 13
      spec/controllers/account_controller_spec.rb
  2. 30
      spec/controllers/my_controller_spec.rb

@ -209,6 +209,19 @@ describe AccountController do
end
end
describe 'POST #change_password' do
context 'with disabled password login' do
before do
OmniauthLogin.stub(:disable_password_login?).and_return(true)
post :change_password
end
it 'is not found' do
expect(response.status).to eq 404
end
end
end
context 'GET #register' do
context 'with self registration on' do
before do

@ -47,6 +47,17 @@ describe MyController, :type => :controller do
end
end
describe 'with disabled password login' do
before do
OmniauthLogin.stub(:disable_password_login?).and_return(true)
post :change_password
end
it 'is not found' do
expect(response.status).to eq 404
end
end
describe 'with wrong confirmation' do
before do
post :change_password, :password => 'adminADMIN!',
@ -124,6 +135,25 @@ describe MyController, :type => :controller do
it "renders editable custom fields" do
expect(response.body).to have_content(custom_field.name)
end
it "renders the 'Change password' menu entry" do
expect(response.body).to have_selector('#menu-sidebar li a', text: 'Change password')
end
end
end
describe 'account with disabled password login' do
before do
OmniauthLogin.stub(:disable_password_login?).and_return(true)
as_logged_in_user user do
get :account
end
end
render_views
it "does not render 'Change password' menu entry" do
expect(response.body).not_to have_selector('#menu-sidebar li a', text: 'Change password')
end
end

Loading…
Cancel
Save