Organize feature specs in sub directories
This commit is contained in:
18
spec/features/sessions/sign_in_spec.rb
Normal file
18
spec/features/sessions/sign_in_spec.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
feature 'User sign in' do
|
||||
scenario 'redirects to the home page when not signed in' do
|
||||
visit root_path
|
||||
|
||||
expect(current_path).to eq new_session_path
|
||||
end
|
||||
|
||||
scenario 'signs the user in' do
|
||||
user = FactoryGirl.create(:user)
|
||||
|
||||
visit new_session_path
|
||||
fill_in 'Email', with: user.email
|
||||
fill_in 'Password', with: user.password
|
||||
click_button 'Sign in'
|
||||
|
||||
expect(current_path).to eq root_path
|
||||
end
|
||||
end
|
22
spec/features/sessions/sign_up_spec.rb
Normal file
22
spec/features/sessions/sign_up_spec.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
feature 'User sign up' do
|
||||
let(:user) { FactoryGirl.build(:user) }
|
||||
|
||||
background do
|
||||
visit new_user_path
|
||||
fill_in 'Email', with: user.email
|
||||
fill_in 'Password', with: user.password
|
||||
fill_in 'Password confirmation', with: user.password
|
||||
end
|
||||
|
||||
scenario 'creates the user' do
|
||||
expect {
|
||||
click_button 'Sign up'
|
||||
}.to change(User, :count).by(1)
|
||||
end
|
||||
|
||||
scenario 'redirects to the home page' do
|
||||
click_button 'Sign up'
|
||||
|
||||
expect(current_path).to eq root_path
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user