|
|
|
@ -1002,6 +1002,7 @@ RSpec.describe UsersController, type: :request do
|
|
|
|
|
email: "new_user@example.com", |
|
|
|
|
role: "data_coordinator", |
|
|
|
|
phone: "12345678910", |
|
|
|
|
phone_extension: "1234", |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
end |
|
|
|
@ -1025,12 +1026,14 @@ RSpec.describe UsersController, type: :request do
|
|
|
|
|
request |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "creates a new scheme for user organisation with valid params" do |
|
|
|
|
it "creates a new user for user organisation with valid params" do |
|
|
|
|
request |
|
|
|
|
|
|
|
|
|
expect(User.last.name).to eq("new user") |
|
|
|
|
expect(User.last.email).to eq("new_user@example.com") |
|
|
|
|
expect(User.last.role).to eq("data_coordinator") |
|
|
|
|
expect(User.last.phone).to eq("12345678910") |
|
|
|
|
expect(User.last.phone_extension).to eq("1234") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "redirects back to organisation users page" do |
|
|
|
@ -1617,11 +1620,12 @@ RSpec.describe UsersController, type: :request do
|
|
|
|
|
expect(page).to have_content("Change your personal details") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has fields for name, email, role, dpo and key contact" do |
|
|
|
|
it "has fields for name, email, role, phone number and phone extension" do |
|
|
|
|
expect(page).to have_field("user[name]") |
|
|
|
|
expect(page).to have_field("user[email]") |
|
|
|
|
expect(page).to have_field("user[role]") |
|
|
|
|
expect(page).to have_field("user[phone]") |
|
|
|
|
expect(page).to have_field("user[phone_extension]") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "allows setting the role to `support`" do |
|
|
|
@ -1643,10 +1647,12 @@ RSpec.describe UsersController, type: :request do
|
|
|
|
|
expect(page).to have_content("Change #{other_user.name}’s personal details") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has fields for name, email, role, dpo and key contact" do |
|
|
|
|
it "has fields for name, email, role, phone number and phone extension" do |
|
|
|
|
expect(page).to have_field("user[name]") |
|
|
|
|
expect(page).to have_field("user[email]") |
|
|
|
|
expect(page).to have_field("user[role]") |
|
|
|
|
expect(page).to have_field("user[phone]") |
|
|
|
|
expect(page).to have_field("user[phone_extension]") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -1661,10 +1667,12 @@ RSpec.describe UsersController, type: :request do
|
|
|
|
|
expect(page).to have_content("Change #{other_user.name}’s personal details") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has fields for name, email, role, dpo and key contact" do |
|
|
|
|
it "has fields for name, email, role, phone number and phone extension" do |
|
|
|
|
expect(page).to have_field("user[name]") |
|
|
|
|
expect(page).to have_field("user[email]") |
|
|
|
|
expect(page).to have_field("user[role]") |
|
|
|
|
expect(page).to have_field("user[phone]") |
|
|
|
|
expect(page).to have_field("user[phone_extension]") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -1994,6 +2002,7 @@ RSpec.describe UsersController, type: :request do
|
|
|
|
|
email:, |
|
|
|
|
role: "data_coordinator", |
|
|
|
|
phone: "12345612456", |
|
|
|
|
phone_extension: "1234", |
|
|
|
|
organisation_id: organisation.id, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
@ -2009,6 +2018,14 @@ RSpec.describe UsersController, type: :request do
|
|
|
|
|
expect(User.find_by(email:).organisation).to eq(organisation) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "sets expected values on the user" do |
|
|
|
|
request |
|
|
|
|
user = User.find_by(email:) |
|
|
|
|
expect(user.name).to eq("new user") |
|
|
|
|
expect(user.phone).to eq("12345612456") |
|
|
|
|
expect(user.phone_extension).to eq("1234") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "redirects back to users page" do |
|
|
|
|
request |
|
|
|
|
expect(response).to redirect_to("/users") |
|
|
|
|