enspiral/loomio — pull request #201 by rtacconi (2012-06-08 11:09:37+00:00)
Title: Delete user2

there is the deactivate! and activate! methods to be used instead of destroy and delete on user. There is the devise method too which prevents the login of not active users, there are seen as not active by devise, not deleted. /spec/requests has the test for the log in and user_spec.rb tests the model.

Regarding user.name I overridden the name attribute in the user model which is very simple and keeps the logic in the model, not in the view.

in requests I usually use something like this:

feature "Logins" do
include AcceptanceTest

background do
@user = User.make!
@user.company.setting.update_attributes(:bank_name => "A bank",
:branch => 'Stratform Upon Avon',
:sort_code => '444444',
:account_number => '084039089234')
end

scenario %q{Successfully login as Seller",
Given I am a Guest (In all cases that a guest is a seller)
When I am in the login page
And I fill in my email
And I fill in my password
And I click the Sign in button
Then I should be redirected to Seller dashboard
} do
visit user_session_path
fill_in 'sign_in_user_email', :with => @user.email
fill_in 'sign_in_user_password', :with => @user.password
click_button 'Sign in'
current_path.should == dashboard_path
end

but since you are using 'it' it is not possible.