diff --git a/db/schema.rb b/db/schema.rb index 27ee1c37b..d8c47a9cb 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -914,7 +914,7 @@ ActiveRecord::Schema.define(version: 20171026090804) do CASE WHEN (teams.created_by_id = user_teams.user_id) THEN false ELSE true - END AS can_be_leaved, + END AS can_be_left, user_teams.id AS user_team_id, user_teams.user_id FROM (teams diff --git a/db/views/datatables_teams_v01.sql b/db/views/datatables_teams_v01.sql index 25ed66b2a..276290608 100644 --- a/db/views/datatables_teams_v01.sql +++ b/db/views/datatables_teams_v01.sql @@ -7,7 +7,7 @@ SELECT FROM user_teams WHERE user_teams.team_id = teams.id ) AS members, - CASE WHEN teams.created_by_id = user_teams.user_id THEN false ELSE true END AS can_be_leaved, + CASE WHEN teams.created_by_id = user_teams.user_id THEN false ELSE true END AS can_be_left, user_teams.id AS user_team_id, user_teams.user_id AS user_id FROM teams INNER JOIN user_teams ON teams.id=user_teams.team_id diff --git a/spec/models/datatables/teams_spec.rb b/spec/models/datatables/teams_spec.rb index ab740da84..c69c8a82a 100644 --- a/spec/models/datatables/teams_spec.rb +++ b/spec/models/datatables/teams_spec.rb @@ -8,6 +8,7 @@ RSpec.describe Datatables::DatatablesTeam, type: :model do it { should have_db_column :role } it { should have_db_column :user_team_id } it { should have_db_column :user_id } + it { should have_db_column :can_be_left } end describe 'is readonly' do diff --git a/spec/support/api/schemas/teams.json b/spec/support/api/schemas/teams.json index 4e3efbcd4..27ad92d03 100644 --- a/spec/support/api/schemas/teams.json +++ b/spec/support/api/schemas/teams.json @@ -5,13 +5,13 @@ "teams": { "type": "array", "items":{ - "required": ["id", "name", "members", "role", "can_be_leaved", "user_team_id"], + "required": ["id", "name", "members", "role", "can_be_left", "user_team_id"], "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "members": { "type": "integer" }, "role": { "type": "integer" }, - "can_be_leaved": { "type": "boolean" }, + "can_be_left": { "type": "boolean" }, "user_team_id": { "type": "integer" }, "user_id": { "type": "integer" } }