mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-26 20:54:21 +01:00
add test for member autocomplete
This commit is contained in:
parent
80aab9f17c
commit
62410da9e1
@ -160,10 +160,14 @@ This procedure is not easy to follow so if you don't need to write some code for
|
|||||||
- **Please note**: Your password length must be between 8 and 128 characters, otherwise db:seed will be rejected. This is configured in [config/initializers/devise.rb](config/initializers/devise.rb)
|
- **Please note**: Your password length must be between 8 and 128 characters, otherwise db:seed will be rejected. This is configured in [config/initializers/devise.rb](config/initializers/devise.rb)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# for dev
|
||||||
rake db:create
|
rake db:create
|
||||||
rake db:migrate
|
rake db:migrate
|
||||||
ADMIN_EMAIL='youradminemail' ADMIN_PASSWORD='youradminpassword' rake db:seed
|
ADMIN_EMAIL='youradminemail' ADMIN_PASSWORD='youradminpassword' rake db:seed
|
||||||
rake fablab:es_build_stats
|
rake fablab:es_build_stats
|
||||||
|
# for tests
|
||||||
|
RAILS_ENV=test rake db:create
|
||||||
|
RAILS_ENV=test rake db:migrate
|
||||||
```
|
```
|
||||||
|
|
||||||
14. Create the pids folder used by Sidekiq. If you want to use a different location, you can configure it in `config/sidekiq.yml`
|
14. Create the pids folder used by Sidekiq. If you want to use a different location, you can configure it in `config/sidekiq.yml`
|
||||||
@ -252,6 +256,9 @@ environment.
|
|||||||
rake db:migrate
|
rake db:migrate
|
||||||
ADMIN_EMAIL='youradminemail' ADMIN_PASSWORD='youradminpassword' rake db:seed
|
ADMIN_EMAIL='youradminemail' ADMIN_PASSWORD='youradminpassword' rake db:seed
|
||||||
rake fablab:es_build_stats
|
rake fablab:es_build_stats
|
||||||
|
# for tests
|
||||||
|
RAILS_ENV=test rake db:create
|
||||||
|
RAILS_ENV=test rake db:migrate
|
||||||
```
|
```
|
||||||
|
|
||||||
11. Start the application and visit `localhost:3000` on your browser to check that it works:
|
11. Start the application and visit `localhost:3000` on your browser to check that it works:
|
||||||
|
@ -231,9 +231,9 @@ class API::MembersController < API::ApiController
|
|||||||
@members = @members.where("users.is_allow_contact = 'true'")
|
@members = @members.where("users.is_allow_contact = 'true'")
|
||||||
else
|
else
|
||||||
# only admins have the ability to filter by subscription
|
# only admins have the ability to filter by subscription
|
||||||
if params[:subscription] === 'true'
|
if params[:subscription] == 'true'
|
||||||
@members = @members.where('subscriptions.id IS NOT NULL AND subscriptions.expiration_date >= :now', now: Date.today.to_s)
|
@members = @members.where('subscriptions.id IS NOT NULL AND subscriptions.expiration_date >= :now', now: Date.today.to_s)
|
||||||
elsif params[:subscription] === 'false'
|
elsif params[:subscription] == 'false'
|
||||||
@members = @members.where('subscriptions.id IS NULL OR subscriptions.expiration_date < :now', now: Date.today.to_s)
|
@members = @members.where('subscriptions.id IS NULL OR subscriptions.expiration_date < :now', now: Date.today.to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
154
db/schema.rb
154
db/schema.rb
@ -15,8 +15,8 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
enable_extension "pg_trgm"
|
|
||||||
enable_extension "unaccent"
|
enable_extension "unaccent"
|
||||||
|
enable_extension "pg_trgm"
|
||||||
|
|
||||||
create_table "abuses", force: :cascade do |t|
|
create_table "abuses", force: :cascade do |t|
|
||||||
t.integer "signaled_id"
|
t.integer "signaled_id"
|
||||||
@ -31,24 +31,15 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
|
|
||||||
add_index "abuses", ["signaled_type", "signaled_id"], name: "index_abuses_on_signaled_type_and_signaled_id", using: :btree
|
add_index "abuses", ["signaled_type", "signaled_id"], name: "index_abuses_on_signaled_type_and_signaled_id", using: :btree
|
||||||
|
|
||||||
create_table "accounting_periods", force: :cascade do |t|
|
|
||||||
t.date "start_at"
|
|
||||||
t.date "end_at"
|
|
||||||
t.datetime "closed_at"
|
|
||||||
t.integer "closed_by"
|
|
||||||
t.datetime "created_at", null: false
|
|
||||||
t.datetime "updated_at", null: false
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "addresses", force: :cascade do |t|
|
create_table "addresses", force: :cascade do |t|
|
||||||
t.string "address", limit: 255
|
t.string "address"
|
||||||
t.string "street_number", limit: 255
|
t.string "street_number"
|
||||||
t.string "route", limit: 255
|
t.string "route"
|
||||||
t.string "locality", limit: 255
|
t.string "locality"
|
||||||
t.string "country", limit: 255
|
t.string "country"
|
||||||
t.string "postal_code", limit: 255
|
t.string "postal_code"
|
||||||
t.integer "placeable_id"
|
t.integer "placeable_id"
|
||||||
t.string "placeable_type", limit: 255
|
t.string "placeable_type"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
@ -64,9 +55,9 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
|
|
||||||
create_table "assets", force: :cascade do |t|
|
create_table "assets", force: :cascade do |t|
|
||||||
t.integer "viewable_id"
|
t.integer "viewable_id"
|
||||||
t.string "viewable_type", limit: 255
|
t.string "viewable_type"
|
||||||
t.string "attachment", limit: 255
|
t.string "attachment"
|
||||||
t.string "type", limit: 255
|
t.string "type"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
@ -83,7 +74,7 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
create_table "availabilities", force: :cascade do |t|
|
create_table "availabilities", force: :cascade do |t|
|
||||||
t.datetime "start_at"
|
t.datetime "start_at"
|
||||||
t.datetime "end_at"
|
t.datetime "end_at"
|
||||||
t.string "available_type", limit: 255
|
t.string "available_type"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.integer "nb_total_places"
|
t.integer "nb_total_places"
|
||||||
@ -102,7 +93,7 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
add_index "availability_tags", ["tag_id"], name: "index_availability_tags_on_tag_id", using: :btree
|
add_index "availability_tags", ["tag_id"], name: "index_availability_tags_on_tag_id", using: :btree
|
||||||
|
|
||||||
create_table "categories", force: :cascade do |t|
|
create_table "categories", force: :cascade do |t|
|
||||||
t.string "name", limit: 255
|
t.string "name"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "slug"
|
t.string "slug"
|
||||||
@ -111,7 +102,7 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
add_index "categories", ["slug"], name: "index_categories_on_slug", unique: true, using: :btree
|
add_index "categories", ["slug"], name: "index_categories_on_slug", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "components", force: :cascade do |t|
|
create_table "components", force: :cascade do |t|
|
||||||
t.string "name", limit: 255, null: false
|
t.string "name", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "coupons", force: :cascade do |t|
|
create_table "coupons", force: :cascade do |t|
|
||||||
@ -129,7 +120,7 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
|
|
||||||
create_table "credits", force: :cascade do |t|
|
create_table "credits", force: :cascade do |t|
|
||||||
t.integer "creditable_id"
|
t.integer "creditable_id"
|
||||||
t.string "creditable_type", limit: 255
|
t.string "creditable_type"
|
||||||
t.integer "plan_id"
|
t.integer "plan_id"
|
||||||
t.integer "hours"
|
t.integer "hours"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
@ -170,7 +161,7 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
add_index "event_themes", ["slug"], name: "index_event_themes_on_slug", unique: true, using: :btree
|
add_index "event_themes", ["slug"], name: "index_event_themes_on_slug", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "events", force: :cascade do |t|
|
create_table "events", force: :cascade do |t|
|
||||||
t.string "title", limit: 255
|
t.string "title"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
@ -208,10 +199,10 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
add_index "exports", ["user_id"], name: "index_exports_on_user_id", using: :btree
|
add_index "exports", ["user_id"], name: "index_exports_on_user_id", using: :btree
|
||||||
|
|
||||||
create_table "friendly_id_slugs", force: :cascade do |t|
|
create_table "friendly_id_slugs", force: :cascade do |t|
|
||||||
t.string "slug", limit: 255, null: false
|
t.string "slug", null: false
|
||||||
t.integer "sluggable_id", null: false
|
t.integer "sluggable_id", null: false
|
||||||
t.string "sluggable_type", limit: 50
|
t.string "sluggable_type", limit: 50
|
||||||
t.string "scope", limit: 255
|
t.string "scope"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -221,10 +212,10 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree
|
add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree
|
||||||
|
|
||||||
create_table "groups", force: :cascade do |t|
|
create_table "groups", force: :cascade do |t|
|
||||||
t.string "name", limit: 255
|
t.string "name"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "slug", limit: 255
|
t.string "slug"
|
||||||
t.boolean "disabled"
|
t.boolean "disabled"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -243,7 +234,7 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
|
|
||||||
create_table "invoice_items", force: :cascade do |t|
|
create_table "invoice_items", force: :cascade do |t|
|
||||||
t.integer "invoice_id"
|
t.integer "invoice_id"
|
||||||
t.string "stp_invoice_item_id", limit: 255
|
t.string "stp_invoice_item_id"
|
||||||
t.integer "amount"
|
t.integer "amount"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
@ -256,17 +247,17 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
|
|
||||||
create_table "invoices", force: :cascade do |t|
|
create_table "invoices", force: :cascade do |t|
|
||||||
t.integer "invoiced_id"
|
t.integer "invoiced_id"
|
||||||
t.string "invoiced_type", limit: 255
|
t.string "invoiced_type"
|
||||||
t.string "stp_invoice_id", limit: 255
|
t.string "stp_invoice_id"
|
||||||
t.integer "total"
|
t.integer "total"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.string "reference", limit: 255
|
t.string "reference"
|
||||||
t.string "avoir_mode", limit: 255
|
t.string "avoir_mode"
|
||||||
t.datetime "avoir_date"
|
t.datetime "avoir_date"
|
||||||
t.integer "invoice_id"
|
t.integer "invoice_id"
|
||||||
t.string "type", limit: 255
|
t.string "type"
|
||||||
t.boolean "subscription_to_expire"
|
t.boolean "subscription_to_expire"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.integer "wallet_amount"
|
t.integer "wallet_amount"
|
||||||
@ -280,17 +271,17 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
add_index "invoices", ["wallet_transaction_id"], name: "index_invoices_on_wallet_transaction_id", using: :btree
|
add_index "invoices", ["wallet_transaction_id"], name: "index_invoices_on_wallet_transaction_id", using: :btree
|
||||||
|
|
||||||
create_table "licences", force: :cascade do |t|
|
create_table "licences", force: :cascade do |t|
|
||||||
t.string "name", limit: 255, null: false
|
t.string "name", null: false
|
||||||
t.text "description"
|
t.text "description"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "machines", force: :cascade do |t|
|
create_table "machines", force: :cascade do |t|
|
||||||
t.string "name", limit: 255, null: false
|
t.string "name", null: false
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.text "spec"
|
t.text "spec"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "slug", limit: 255
|
t.string "slug"
|
||||||
t.boolean "disabled"
|
t.boolean "disabled"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -307,7 +298,7 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
create_table "notifications", force: :cascade do |t|
|
create_table "notifications", force: :cascade do |t|
|
||||||
t.integer "receiver_id"
|
t.integer "receiver_id"
|
||||||
t.integer "attached_object_id"
|
t.integer "attached_object_id"
|
||||||
t.string "attached_object_type", limit: 255
|
t.string "attached_object_type"
|
||||||
t.integer "notification_type_id"
|
t.integer "notification_type_id"
|
||||||
t.boolean "is_read", default: false
|
t.boolean "is_read", default: false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
@ -383,11 +374,11 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
add_index "organizations", ["profile_id"], name: "index_organizations_on_profile_id", using: :btree
|
add_index "organizations", ["profile_id"], name: "index_organizations_on_profile_id", using: :btree
|
||||||
|
|
||||||
create_table "plans", force: :cascade do |t|
|
create_table "plans", force: :cascade do |t|
|
||||||
t.string "name", limit: 255
|
t.string "name"
|
||||||
t.integer "amount"
|
t.integer "amount"
|
||||||
t.string "interval", limit: 255
|
t.string "interval"
|
||||||
t.integer "group_id"
|
t.integer "group_id"
|
||||||
t.string "stp_plan_id", limit: 255
|
t.string "stp_plan_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.integer "training_credit_nb", default: 0
|
t.integer "training_credit_nb", default: 0
|
||||||
@ -426,11 +417,11 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
|
|
||||||
create_table "profiles", force: :cascade do |t|
|
create_table "profiles", force: :cascade do |t|
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.string "first_name", limit: 255
|
t.string "first_name"
|
||||||
t.string "last_name", limit: 255
|
t.string "last_name"
|
||||||
t.boolean "gender"
|
t.boolean "gender"
|
||||||
t.date "birthday"
|
t.date "birthday"
|
||||||
t.string "phone", limit: 255
|
t.string "phone"
|
||||||
t.text "interest"
|
t.text "interest"
|
||||||
t.text "software_mastered"
|
t.text "software_mastered"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
@ -460,7 +451,7 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "title", limit: 255
|
t.string "title"
|
||||||
t.integer "step_nb"
|
t.integer "step_nb"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -472,26 +463,26 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.boolean "is_valid", default: false
|
t.boolean "is_valid", default: false
|
||||||
t.string "valid_token", limit: 255
|
t.string "valid_token"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "project_users", ["project_id"], name: "index_project_users_on_project_id", using: :btree
|
add_index "project_users", ["project_id"], name: "index_project_users_on_project_id", using: :btree
|
||||||
add_index "project_users", ["user_id"], name: "index_project_users_on_user_id", using: :btree
|
add_index "project_users", ["user_id"], name: "index_project_users_on_user_id", using: :btree
|
||||||
|
|
||||||
create_table "projects", force: :cascade do |t|
|
create_table "projects", force: :cascade do |t|
|
||||||
t.string "name", limit: 255
|
t.string "name"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.integer "author_id"
|
t.integer "author_id"
|
||||||
t.text "tags"
|
t.text "tags"
|
||||||
t.integer "licence_id"
|
t.integer "licence_id"
|
||||||
t.string "state", limit: 255
|
t.string "state"
|
||||||
t.string "slug", limit: 255
|
t.string "slug"
|
||||||
t.datetime "published_at"
|
t.datetime "published_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "projects", ["slug"], name: "index_projects_on_slug", using: :btree
|
add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "projects_components", force: :cascade do |t|
|
create_table "projects_components", force: :cascade do |t|
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
@ -531,19 +522,19 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.integer "reservable_id"
|
t.integer "reservable_id"
|
||||||
t.string "reservable_type", limit: 255
|
t.string "reservable_type"
|
||||||
t.string "stp_invoice_id", limit: 255
|
t.string "stp_invoice_id"
|
||||||
t.integer "nb_reserve_places"
|
t.integer "nb_reserve_places"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "reservations", ["reservable_id", "reservable_type"], name: "index_reservations_on_reservable_id_and_reservable_type", using: :btree
|
add_index "reservations", ["reservable_type", "reservable_id"], name: "index_reservations_on_reservable_type_and_reservable_id", using: :btree
|
||||||
add_index "reservations", ["stp_invoice_id"], name: "index_reservations_on_stp_invoice_id", using: :btree
|
add_index "reservations", ["stp_invoice_id"], name: "index_reservations_on_stp_invoice_id", using: :btree
|
||||||
add_index "reservations", ["user_id"], name: "index_reservations_on_user_id", using: :btree
|
add_index "reservations", ["user_id"], name: "index_reservations_on_user_id", using: :btree
|
||||||
|
|
||||||
create_table "roles", force: :cascade do |t|
|
create_table "roles", force: :cascade do |t|
|
||||||
t.string "name", limit: 255
|
t.string "name"
|
||||||
t.integer "resource_id"
|
t.integer "resource_id"
|
||||||
t.string "resource_type", limit: 255
|
t.string "resource_type"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
@ -617,18 +608,18 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
|
|
||||||
create_table "statistic_fields", force: :cascade do |t|
|
create_table "statistic_fields", force: :cascade do |t|
|
||||||
t.integer "statistic_index_id"
|
t.integer "statistic_index_id"
|
||||||
t.string "key", limit: 255
|
t.string "key"
|
||||||
t.string "label", limit: 255
|
t.string "label"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "data_type", limit: 255
|
t.string "data_type"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "statistic_fields", ["statistic_index_id"], name: "index_statistic_fields_on_statistic_index_id", using: :btree
|
add_index "statistic_fields", ["statistic_index_id"], name: "index_statistic_fields_on_statistic_index_id", using: :btree
|
||||||
|
|
||||||
create_table "statistic_graphs", force: :cascade do |t|
|
create_table "statistic_graphs", force: :cascade do |t|
|
||||||
t.integer "statistic_index_id"
|
t.integer "statistic_index_id"
|
||||||
t.string "chart_type", limit: 255
|
t.string "chart_type"
|
||||||
t.integer "limit"
|
t.integer "limit"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
@ -637,8 +628,8 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
add_index "statistic_graphs", ["statistic_index_id"], name: "index_statistic_graphs_on_statistic_index_id", using: :btree
|
add_index "statistic_graphs", ["statistic_index_id"], name: "index_statistic_graphs_on_statistic_index_id", using: :btree
|
||||||
|
|
||||||
create_table "statistic_indices", force: :cascade do |t|
|
create_table "statistic_indices", force: :cascade do |t|
|
||||||
t.string "es_type_key", limit: 255
|
t.string "es_type_key"
|
||||||
t.string "label", limit: 255
|
t.string "label"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.boolean "table", default: true
|
t.boolean "table", default: true
|
||||||
@ -646,8 +637,8 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
create_table "statistic_sub_types", force: :cascade do |t|
|
create_table "statistic_sub_types", force: :cascade do |t|
|
||||||
t.string "key", limit: 255
|
t.string "key"
|
||||||
t.string "label", limit: 255
|
t.string "label"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
@ -664,8 +655,8 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
|
|
||||||
create_table "statistic_types", force: :cascade do |t|
|
create_table "statistic_types", force: :cascade do |t|
|
||||||
t.integer "statistic_index_id"
|
t.integer "statistic_index_id"
|
||||||
t.string "key", limit: 255
|
t.string "key"
|
||||||
t.string "label", limit: 255
|
t.string "label"
|
||||||
t.boolean "graph"
|
t.boolean "graph"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
@ -683,7 +674,7 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
create_table "subscriptions", force: :cascade do |t|
|
create_table "subscriptions", force: :cascade do |t|
|
||||||
t.integer "plan_id"
|
t.integer "plan_id"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.string "stp_subscription_id", limit: 255
|
t.string "stp_subscription_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.datetime "expiration_date"
|
t.datetime "expiration_date"
|
||||||
@ -702,7 +693,7 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
|
add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "themes", force: :cascade do |t|
|
create_table "themes", force: :cascade do |t|
|
||||||
t.string "name", limit: 255, null: false
|
t.string "name", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "tickets", force: :cascade do |t|
|
create_table "tickets", force: :cascade do |t|
|
||||||
@ -717,11 +708,11 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
add_index "tickets", ["reservation_id"], name: "index_tickets_on_reservation_id", using: :btree
|
add_index "tickets", ["reservation_id"], name: "index_tickets_on_reservation_id", using: :btree
|
||||||
|
|
||||||
create_table "trainings", force: :cascade do |t|
|
create_table "trainings", force: :cascade do |t|
|
||||||
t.string "name", limit: 255
|
t.string "name"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.integer "nb_total_places"
|
t.integer "nb_total_places"
|
||||||
t.string "slug", limit: 255
|
t.string "slug"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.boolean "public_page", default: true
|
t.boolean "public_page", default: true
|
||||||
t.boolean "disabled"
|
t.boolean "disabled"
|
||||||
@ -779,30 +770,30 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
add_index "user_trainings", ["user_id"], name: "index_user_trainings_on_user_id", using: :btree
|
add_index "user_trainings", ["user_id"], name: "index_user_trainings_on_user_id", using: :btree
|
||||||
|
|
||||||
create_table "users", force: :cascade do |t|
|
create_table "users", force: :cascade do |t|
|
||||||
t.string "email", limit: 255, default: "", null: false
|
t.string "email", default: "", null: false
|
||||||
t.string "encrypted_password", limit: 255, default: "", null: false
|
t.string "encrypted_password", default: "", null: false
|
||||||
t.string "reset_password_token", limit: 255
|
t.string "reset_password_token"
|
||||||
t.datetime "reset_password_sent_at"
|
t.datetime "reset_password_sent_at"
|
||||||
t.datetime "remember_created_at"
|
t.datetime "remember_created_at"
|
||||||
t.integer "sign_in_count", default: 0, null: false
|
t.integer "sign_in_count", default: 0, null: false
|
||||||
t.datetime "current_sign_in_at"
|
t.datetime "current_sign_in_at"
|
||||||
t.datetime "last_sign_in_at"
|
t.datetime "last_sign_in_at"
|
||||||
t.string "current_sign_in_ip", limit: 255
|
t.string "current_sign_in_ip"
|
||||||
t.string "last_sign_in_ip", limit: 255
|
t.string "last_sign_in_ip"
|
||||||
t.string "confirmation_token", limit: 255
|
t.string "confirmation_token"
|
||||||
t.datetime "confirmed_at"
|
t.datetime "confirmed_at"
|
||||||
t.datetime "confirmation_sent_at"
|
t.datetime "confirmation_sent_at"
|
||||||
t.string "unconfirmed_email", limit: 255
|
t.string "unconfirmed_email"
|
||||||
t.integer "failed_attempts", default: 0, null: false
|
t.integer "failed_attempts", default: 0, null: false
|
||||||
t.string "unlock_token", limit: 255
|
t.string "unlock_token"
|
||||||
t.datetime "locked_at"
|
t.datetime "locked_at"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.boolean "is_allow_contact", default: true
|
t.boolean "is_allow_contact", default: true
|
||||||
t.integer "group_id"
|
t.integer "group_id"
|
||||||
t.string "stp_customer_id", limit: 255
|
t.string "stp_customer_id"
|
||||||
t.string "username", limit: 255
|
t.string "username"
|
||||||
t.string "slug", limit: 255
|
t.string "slug"
|
||||||
t.boolean "is_active", default: true
|
t.boolean "is_active", default: true
|
||||||
t.string "provider"
|
t.string "provider"
|
||||||
t.string "uid"
|
t.string "uid"
|
||||||
@ -864,7 +855,6 @@ ActiveRecord::Schema.define(version: 20190110150532) do
|
|||||||
|
|
||||||
add_index "wallets", ["user_id"], name: "index_wallets_on_user_id", using: :btree
|
add_index "wallets", ["user_id"], name: "index_wallets_on_user_id", using: :btree
|
||||||
|
|
||||||
add_foreign_key "accounting_periods", "users", column: "closed_by"
|
|
||||||
add_foreign_key "availability_tags", "availabilities"
|
add_foreign_key "availability_tags", "availabilities"
|
||||||
add_foreign_key "availability_tags", "tags"
|
add_foreign_key "availability_tags", "tags"
|
||||||
add_foreign_key "event_price_categories", "events"
|
add_foreign_key "event_price_categories", "events"
|
||||||
|
@ -84,4 +84,18 @@ class MembersTest < ActionDispatch::IntegrationTest
|
|||||||
assert_equal 2, res[:group_id], "user's group does not match"
|
assert_equal 2, res[:group_id], "user's group does not match"
|
||||||
assert_equal instagram, res[:profile][:instagram], "user's social network not updated"
|
assert_equal instagram, res[:profile][:instagram], "user's social network not updated"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'admin search for autocompletion of a member s name' do
|
||||||
|
get '/api/members/search/kevin?subscription=true'
|
||||||
|
|
||||||
|
# Check response format & status
|
||||||
|
assert_equal 200, response.status, response.body
|
||||||
|
assert_equal Mime::JSON, response.content_type
|
||||||
|
|
||||||
|
# Check search result
|
||||||
|
res = json_response(response.body)
|
||||||
|
assert_equal 1, res.length
|
||||||
|
|
||||||
|
assert_match /Kevin/, res[0][:name]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module Events
|
module Prices
|
||||||
class AsAdminTest < ActionDispatch::IntegrationTest
|
class AsAdminTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@ -35,7 +35,9 @@ module Events
|
|||||||
|
|
||||||
# Check the price was computed correctly
|
# Check the price was computed correctly
|
||||||
price = json_response(response.body)
|
price = json_response(response.body)
|
||||||
assert_equal (printer_training.trainings_pricings.where(group_id: user.group_id).first.amount / 100.0), price[:price], 'Computed price did not match training price'
|
assert_equal (printer_training.trainings_pricings.where(group_id: user.group_id).first.amount / 100.0),
|
||||||
|
price[:price],
|
||||||
|
'Computed price did not match training price'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -76,7 +78,9 @@ module Events
|
|||||||
|
|
||||||
# Check the event was created correctly
|
# Check the event was created correctly
|
||||||
price = json_response(response.body)
|
price = json_response(response.body)
|
||||||
assert_equal ((laser.prices.where(group_id: user.group_id, plan_id: plan.id).first.amount + plan.amount) / 100.0), price[:price], 'Computed price did not match machine + subscription price'
|
assert_equal ((laser.prices.where(group_id: user.group_id, plan_id: plan.id).first.amount + plan.amount) / 100.0),
|
||||||
|
price[:price],
|
||||||
|
'Computed price did not match machine + subscription price'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user