parent
644160faf1
commit
624d2d638f
|
@ -1,9 +1,9 @@
|
|||
FactoryGirl.define do
|
||||
factory :apply do
|
||||
primary_choice_course_id 1
|
||||
secondary_choice_course_id 1
|
||||
comment "MyText"
|
||||
user_id 1
|
||||
primary_choice_course {create :course}
|
||||
comment "Some Comment"
|
||||
sent "2016-05-17"
|
||||
plan "Flex"
|
||||
user { FactoryGirl.create(:user) }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FactoryGirl.define do
|
||||
factory :course do
|
||||
name "MyString"
|
||||
extra "MyString"
|
||||
start "2016-05-17"
|
||||
name "First Course"
|
||||
extra "With Extras"
|
||||
start "2016-06-17"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
include Warden::Test::Helpers
|
||||
Warden.test_mode!
|
||||
|
||||
# Feature: User delete
|
||||
# As a user
|
||||
# I want to delete my user profile
|
||||
# So I can close my account
|
||||
feature 'User delete', :devise, :js do
|
||||
|
||||
after(:each) do
|
||||
Warden.test_reset!
|
||||
end
|
||||
|
||||
# Scenario: User can delete own account
|
||||
# Given I am signed in
|
||||
# When I delete my account
|
||||
# Then I should see an account deleted message
|
||||
scenario 'user can delete own account' do
|
||||
skip 'skip a slow test'
|
||||
user = FactoryGirl.create(:user)
|
||||
login_as(user, :scope => :user)
|
||||
visit edit_user_registration_path(user)
|
||||
click_button 'Cancel my account'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
expect(page).to have_content I18n.t 'devise.registrations.destroyed'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
include Warden::Test::Helpers
|
||||
Warden.test_mode!
|
||||
|
||||
# Feature: User index page
|
||||
# As a user
|
||||
# I want to see a list of users
|
||||
# So I can see who has registered
|
||||
feature 'User index page', :devise do
|
||||
|
||||
after(:each) do
|
||||
Warden.test_reset!
|
||||
end
|
||||
|
||||
# Scenario: User listed on index page
|
||||
# Given I am signed in
|
||||
# When I visit the user index page
|
||||
# Then I see my own email address
|
||||
scenario 'user sees own email address' do
|
||||
user = FactoryGirl.create(:user, :admin)
|
||||
login_as(user, scope: :user)
|
||||
visit users_path
|
||||
expect(page).to have_content user.email
|
||||
end
|
||||
|
||||
end
|
|
@ -5,7 +5,7 @@
|
|||
feature 'Sign Up', :devise do
|
||||
|
||||
scenario 'after good sign up redirect to camp' do
|
||||
sign_up_with('test1@example.com', 'please123', 'please123')
|
||||
sign_up_with("TestName",'test1@example.com', 'please123', 'please123')
|
||||
expect(page.current_path).to eq page_path(:camp)
|
||||
end
|
||||
|
||||
|
@ -14,7 +14,7 @@ feature 'Sign Up', :devise do
|
|||
# When I sign up with a valid email address and password
|
||||
# Then I see a successful sign up message
|
||||
scenario 'visitor can sign up with valid email address and password' do
|
||||
sign_up_with('test@example.com', 'please123', 'please123')
|
||||
sign_up_with("TestName",'test@example.com', 'please123', 'please123')
|
||||
txts = [I18n.t( 'devise.registrations.signed_up'), I18n.t( 'devise.registrations.signed_up_but_unconfirmed')]
|
||||
expect(page).to have_content(/.*#{txts[0]}.*|.*#{txts[1]}.*/)
|
||||
end
|
||||
|
@ -24,7 +24,7 @@ feature 'Sign Up', :devise do
|
|||
# When I sign up with an invalid email address
|
||||
# Then I see an invalid email message
|
||||
scenario 'visitor cannot sign up with invalid email address' do
|
||||
sign_up_with('bogus', 'please123', 'please123')
|
||||
sign_up_with("TestName",'bogus', 'please123', 'please123')
|
||||
expect(page).to have_content 'Email is invalid'
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ feature 'Sign Up', :devise do
|
|||
# When I sign up without a password
|
||||
# Then I see a missing password message
|
||||
scenario 'visitor cannot sign up without password' do
|
||||
sign_up_with('test@example.com', '', '')
|
||||
sign_up_with("TestName",'test@example.com', '', '')
|
||||
expect(page).to have_content "Password can't be blank"
|
||||
end
|
||||
|
||||
|
@ -42,7 +42,7 @@ feature 'Sign Up', :devise do
|
|||
# When I sign up with a short password
|
||||
# Then I see a 'too short password' message
|
||||
scenario 'visitor cannot sign up with a short password' do
|
||||
sign_up_with('test@example.com', 'please', 'please')
|
||||
sign_up_with("TestName",'test@example.com', 'please', 'please')
|
||||
expect(page).to have_content "Password is too short"
|
||||
end
|
||||
|
||||
|
@ -51,7 +51,7 @@ feature 'Sign Up', :devise do
|
|||
# When I sign up without a password confirmation
|
||||
# Then I see a missing password confirmation message
|
||||
scenario 'visitor cannot sign up without password confirmation' do
|
||||
sign_up_with('test@example.com', 'please123', '')
|
||||
sign_up_with("TestName",'test@example.com', 'please123', '')
|
||||
expect(page).to have_content "Password confirmation doesn't match"
|
||||
end
|
||||
|
||||
|
@ -60,7 +60,7 @@ feature 'Sign Up', :devise do
|
|||
# When I sign up with a mismatched password confirmation
|
||||
# Then I should see a mismatched password message
|
||||
scenario 'visitor cannot sign up with mismatched password and confirmation' do
|
||||
sign_up_with('test@example.com', 'please123', 'mismatch')
|
||||
sign_up_with("TestName" , 'test@example.com', 'please123', 'mismatch')
|
||||
expect(page).to have_content "Password confirmation doesn't match"
|
||||
end
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe Apply, type: :mailer do
|
||||
RSpec.describe ApplyMailer, type: :mailer do
|
||||
describe "submit" do
|
||||
let(:mail) { Apply.submit }
|
||||
let(:mail) { ApplyMailer.submit( create :apply ) }
|
||||
|
||||
it "renders the headers" do
|
||||
expect(mail.subject).to eq("Submit")
|
||||
expect(mail.to).to eq(["to@example.org"])
|
||||
expect(mail.subject).to match("submitted")
|
||||
expect(mail.to).to eq(["test@example.com"])
|
||||
expect(mail.from).to eq(["info@webdev.camp"])
|
||||
end
|
||||
|
||||
|
@ -16,11 +16,11 @@ RSpec.describe Apply, type: :mailer do
|
|||
end
|
||||
|
||||
describe "cancel" do
|
||||
let(:mail) { Apply.cancel }
|
||||
let(:mail) { ApplyMailer.cancel(create(:apply) , "No reason") }
|
||||
|
||||
it "renders the headers" do
|
||||
expect(mail.subject).to eq("Cancel")
|
||||
expect(mail.to).to eq(["to@example.org"])
|
||||
expect(mail.subject).to match("cancelled")
|
||||
expect(mail.to).to eq(["test@example.com"])
|
||||
expect(mail.bcc).to eq(["torsten@webdev.camp"])
|
||||
expect(mail.from).to eq(["info@webdev.camp"])
|
||||
end
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
module Features
|
||||
module SessionHelpers
|
||||
def sign_up_with(email, password, confirmation)
|
||||
def sign_up_with(name , email, password, confirmation)
|
||||
visit new_user_registration_path
|
||||
within ".authform" do
|
||||
fill_in 'Name', with: name
|
||||
fill_in 'Email', with: email
|
||||
fill_in 'Password', with: password
|
||||
fill_in 'Password confirmation', :with => confirmation
|
||||
|
|
Loading…
Reference in New Issue