diff --git a/app/views/groups/_create_chat_team.html.haml b/app/views/groups/_create_chat_team.html.haml index f0ace28c4221658ba2548e830557e5e63a9078e1..20de1b4c973cf2ff973f1aba2369c9632c7ae771 100644 --- a/app/views/groups/_create_chat_team.html.haml +++ b/app/views/groups/_create_chat_team.html.haml @@ -10,7 +10,7 @@ Create a Mattermost team for this group %br %small.light.js-toggle-content - Team URL: + Mattermost URL: = Settings.mattermost.host %span> / %span{ "data-bind-out" => "create_chat_team" } diff --git a/db/migrate/20170120131253_create_chat_teams.rb b/db/migrate/20170120131253_create_chat_teams.rb index 699226d60c99ff52d32cd0eb3a68e3239e42c643..7995d383986393a3e9b67a14f49639b2c4f747fc 100644 --- a/db/migrate/20170120131253_create_chat_teams.rb +++ b/db/migrate/20170120131253_create_chat_teams.rb @@ -8,13 +8,11 @@ class CreateChatTeams < ActiveRecord::Migration def change create_table :chat_teams do |t| - t.integer :namespace_id, index: true + t.references :namespace, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } t.string :team_id t.string :name t.timestamps null: false end - - add_concurrent_foreign_key :chat_teams, :namespaces, column: :namespace_id end end diff --git a/db/schema.rb b/db/schema.rb index f42b20652a022ae8ba123e8c9ae7305b6a57d888..43ca05fad8cd5ed0e93ee60ea1357733efb90aa8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -173,14 +173,14 @@ ActiveRecord::Schema.define(version: 20170217151947) do add_index "chat_names", ["user_id", "service_id"], name: "index_chat_names_on_user_id_and_service_id", unique: true, using: :btree create_table "chat_teams", force: :cascade do |t| - t.integer "namespace_id" + t.integer "namespace_id", null: false t.string "team_id" t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - add_index "chat_teams", ["namespace_id"], name: "index_chat_teams_on_namespace_id", using: :btree + add_index "chat_teams", ["namespace_id"], name: "index_chat_teams_on_namespace_id", unique: true, using: :btree create_table "ci_application_settings", force: :cascade do |t| t.boolean "all_broken_builds" @@ -1343,7 +1343,7 @@ ActiveRecord::Schema.define(version: 20170217151947) do add_index "web_hooks", ["project_id"], name: "index_web_hooks_on_project_id", using: :btree add_foreign_key "boards", "projects" - add_foreign_key "chat_teams", "namespaces", name: "fk_3b543909cb", on_delete: :cascade + add_foreign_key "chat_teams", "namespaces", on_delete: :cascade add_foreign_key "issue_metrics", "issues", on_delete: :cascade add_foreign_key "label_priorities", "labels", on_delete: :cascade add_foreign_key "label_priorities", "projects", on_delete: :cascade diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index b4bd192582258febe1daba30dcc8ea8bc073a996..f978075ab930221f3cb1391edd45c47c83459992 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -46,7 +46,10 @@ feature 'Group', feature: true do describe 'Mattermost team creation' do before do - Settings.mattermost['enabled'] = mattermost_enabled + mash = Hashie::Mash.new + mash.enabled = mattermost_enabled + allow(Settings).to receive(:mattermost).and_return(mash) + visit new_group_path end