diff --git a/features/desktop/closes_account.feature b/features/desktop/closes_account.feature index 524714b0bb3c74e1e2e129b3894cf821e43ba9a3..0388943dda38e45c893212afe04cab6b460e2357 100644 --- a/features/desktop/closes_account.feature +++ b/features/desktop/closes_account.feature @@ -16,22 +16,3 @@ Feature: Close account When I try to sign in manually Then I should be on the new user session page And I should see a flash message with a warning - - Scenario: post display should not throw error when mention is removed for the user whose account is closed - Given following users exist: - | username | email | - | Bob Jones | bob@bob.bob | - | Alice Smith | alice@alice.alice | - And a user with email "bob@bob.bob" is connected with "alice@alice.alice" - And Alice has a post mentioning Bob - - Then I sign in as "bob@bob.bob" - When I go to the users edit page - And I follow "close_account" - And I put in my password in "close_account_password" in the modal window - And I press "close_account_confirm" in the modal window - And I confirm the alert - Then I should be on the new user session page - When I sign in as "alice@alice.alice" - And I am on the home page - Then I should see "Bob Jones" diff --git a/spec/controllers/posts_controller_spec.rb b/spec/controllers/posts_controller_spec.rb index e3f7a6071cbd2ac41f8091f4bf1f25f09c08a042..246238484e26e51d84589a831a25a308aac7690b 100644 --- a/spec/controllers/posts_controller_spec.rb +++ b/spec/controllers/posts_controller_spec.rb @@ -30,6 +30,17 @@ describe PostsController, :type => :controller do expect(response).to be_success end + it 'succeeds after removing a mention when closing the mentioned user\'s account' do + user = FactoryGirl.create(:user, :username => "user") + alice.share_with(user.person, alice.aspects.first) + msg = alice.build_post :status_message, text: "Mention @{User ; #{user.diaspora_handle}}", :public => true, :to => 'all' + msg.save! + expect(msg.mentioned_people.count).to eq(1) + user.destroy + get :show, "id" => msg.id + expect(response).to be_success + end + it 'renders the application layout on mobile' do get :show, :id => @message.id, :format => :mobile expect(response).to render_template('layouts/application')