Merge pull request #479 from AyuntamientoMadrid/orgs-responsible
Orgs responsible
This commit is contained in:
@@ -149,6 +149,7 @@ FactoryGirl.define do
|
||||
|
||||
factory :organization do
|
||||
user
|
||||
responsible_name "Johnny Utah"
|
||||
sequence(:name) { |n| "org#{n}" }
|
||||
|
||||
trait :verified do
|
||||
|
||||
@@ -9,6 +9,7 @@ feature 'Organizations' do
|
||||
visit new_organization_registration_path
|
||||
|
||||
fill_in 'user_organization_attributes_name', with: 'Greenpeace'
|
||||
fill_in 'user_organization_attributes_responsible_name', with: 'Dorothy Stowe'
|
||||
fill_in 'user_email', with: 'green@peace.com'
|
||||
fill_in 'user_password', with: 'greenpeace'
|
||||
fill_in 'user_password_confirmation', with: 'greenpeace'
|
||||
|
||||
@@ -2,6 +2,16 @@ require 'rails_helper'
|
||||
|
||||
feature 'Verification path' do
|
||||
|
||||
scenario "User is an organization" do
|
||||
user = create(:user, verified_at: Time.now)
|
||||
create(:organization, user: user)
|
||||
|
||||
login_as(user)
|
||||
visit verification_path
|
||||
|
||||
expect(current_path).to eq account_path
|
||||
end
|
||||
|
||||
scenario "User is verified" do
|
||||
user = create(:user, verified_at: Time.now)
|
||||
|
||||
|
||||
@@ -161,11 +161,12 @@ describe User do
|
||||
end
|
||||
|
||||
describe "organization_attributes" do
|
||||
before(:each) { subject.organization_attributes = {name: 'org'} }
|
||||
before(:each) { subject.organization_attributes = {name: 'org', responsible_name: 'julia'} }
|
||||
|
||||
it "triggers the creation of an associated organization" do
|
||||
expect(subject.organization).to be
|
||||
expect(subject.organization.name).to eq('org')
|
||||
expect(subject.organization.responsible_name).to eq('julia')
|
||||
end
|
||||
|
||||
it "deactivates the validation of username, and activates the validation of organization" do
|
||||
|
||||
Reference in New Issue
Block a user