1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

link HistoryValue to InvoicingProfile + improved invoices tests

This commit is contained in:
Sylvain 2019-06-03 16:51:43 +02:00
parent 7ed97ef35a
commit 9ef2f142bd
16 changed files with 212 additions and 146 deletions

View File

@ -11,7 +11,7 @@ class API::SettingsController < API::ApiController
def update
authorize Setting
@setting = Setting.find_or_initialize_by(name: params[:name])
if @setting.save && @setting.history_values.create(value: setting_params[:value], user: current_user)
if @setting.save && @setting.history_values.create(value: setting_params[:value], invoicing_profile: current_user.invoicing_profile)
render status: :ok
else
render json: @setting.errors.full_messages, status: :unprocessable_entity

View File

@ -5,7 +5,7 @@ require 'checksum'
# Setting values, kept history of modifications
class HistoryValue < ActiveRecord::Base
belongs_to :setting
belongs_to :user
belongs_to :invoicing_profile
after_create :chain_record
@ -18,6 +18,10 @@ class HistoryValue < ActiveRecord::Base
footprint == compute_footprint
end
def user
invoicing_profile.user
end
private
def compute_footprint

View File

@ -9,6 +9,8 @@ class InvoicingProfile < ActiveRecord::Base
has_one :wallet, dependent: :destroy
has_many :wallet_transactions, dependent: :destroy
has_many :history_values, dependent: :nullify
after_create :create_a_wallet

View File

@ -68,6 +68,6 @@ class Setting < ActiveRecord::Base
def value=(val)
admin = User.admins.first
save && history_values.create(user: admin, value: val)
save && history_values.create(invoicing_profile: admin.invoicing_profile, value: val)
end
end

View File

@ -54,8 +54,6 @@ class User < ActiveRecord::Base
has_many :exports, dependent: :destroy
has_many :history_values, dependent: :nullify
# fix for create admin user
before_save do
email&.downcase!

View File

@ -3,10 +3,10 @@ json.setting do
if @show_history
json.history @setting.history_values do |value|
json.extract! value, :id, :value, :created_at
unless value.user_id.nil?
unless value.invoicing_profile.nil?
json.user do
json.id value.user_id
json.name "#{value.user.first_name} #{value.user.last_name}"
json.id value.invoicing_profile.user_id
json.name value.invoicing_profile.full_name
end
end
end

View File

@ -0,0 +1,5 @@
class AddInvoicingProfileToHistoryValue < ActiveRecord::Migration
def change
add_reference :history_values, :invoicing_profile, index: true, foreign_key: true
end
end

View File

@ -0,0 +1,19 @@
class MigrateHistoryValueToInvoicingProfile < ActiveRecord::Migration
def up
HistoryValue.all.each do |hv|
user = User.find(hv.user_id)
hv.update_attributes(
invoicing_profile_id: user.invoicing_profile.id
)
end
end
def down
HistoryValue.all.each do |hv|
invoicing_profile = User.find(hv.invoicing_profile_id)
hv.update_attributes(
user_id: invoicing_profile.user_id
)
end
end
end

View File

@ -0,0 +1,5 @@
class RemoveUserIdFromHistoryValue < ActiveRecord::Migration
def change
remove_reference :history_values, :user, index: true, foreign_key: true
end
end

View File

@ -11,12 +11,12 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190603130038) do
ActiveRecord::Schema.define(version: 20190603141109) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
enable_extension "unaccent"
enable_extension "pg_trgm"
enable_extension "unaccent"
create_table "abuses", force: :cascade do |t|
t.integer "signaled_id"
@ -44,14 +44,14 @@ ActiveRecord::Schema.define(version: 20190603130038) do
end
create_table "addresses", force: :cascade do |t|
t.string "address"
t.string "street_number"
t.string "route"
t.string "locality"
t.string "country"
t.string "postal_code"
t.string "address", limit: 255
t.string "street_number", limit: 255
t.string "route", limit: 255
t.string "locality", limit: 255
t.string "country", limit: 255
t.string "postal_code", limit: 255
t.integer "placeable_id"
t.string "placeable_type"
t.string "placeable_type", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
@ -67,9 +67,9 @@ ActiveRecord::Schema.define(version: 20190603130038) do
create_table "assets", force: :cascade do |t|
t.integer "viewable_id"
t.string "viewable_type"
t.string "attachment"
t.string "type"
t.string "viewable_type", limit: 255
t.string "attachment", limit: 255
t.string "type", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
@ -86,12 +86,12 @@ ActiveRecord::Schema.define(version: 20190603130038) do
create_table "availabilities", force: :cascade do |t|
t.datetime "start_at"
t.datetime "end_at"
t.string "available_type"
t.string "available_type", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.integer "nb_total_places"
t.boolean "destroying", default: false
t.boolean "lock", default: false
t.boolean "destroying", default: false
t.boolean "lock", default: false
end
create_table "availability_tags", force: :cascade do |t|
@ -105,7 +105,7 @@ ActiveRecord::Schema.define(version: 20190603130038) do
add_index "availability_tags", ["tag_id"], name: "index_availability_tags_on_tag_id", using: :btree
create_table "categories", force: :cascade do |t|
t.string "name"
t.string "name", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug"
@ -114,7 +114,7 @@ ActiveRecord::Schema.define(version: 20190603130038) do
add_index "categories", ["slug"], name: "index_categories_on_slug", unique: true, using: :btree
create_table "components", force: :cascade do |t|
t.string "name", null: false
t.string "name", limit: 255, null: false
end
create_table "coupons", force: :cascade do |t|
@ -132,7 +132,7 @@ ActiveRecord::Schema.define(version: 20190603130038) do
create_table "credits", force: :cascade do |t|
t.integer "creditable_id"
t.string "creditable_type"
t.string "creditable_type", limit: 255
t.integer "plan_id"
t.integer "hours"
t.datetime "created_at"
@ -173,7 +173,7 @@ ActiveRecord::Schema.define(version: 20190603130038) do
add_index "event_themes", ["slug"], name: "index_event_themes_on_slug", unique: true, using: :btree
create_table "events", force: :cascade do |t|
t.string "title"
t.string "title", limit: 255
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
@ -211,10 +211,10 @@ ActiveRecord::Schema.define(version: 20190603130038) do
add_index "exports", ["user_id"], name: "index_exports_on_user_id", using: :btree
create_table "friendly_id_slugs", force: :cascade do |t|
t.string "slug", null: false
t.integer "sluggable_id", null: false
t.string "slug", limit: 255, null: false
t.integer "sluggable_id", null: false
t.string "sluggable_type", limit: 50
t.string "scope"
t.string "scope", limit: 255
t.datetime "created_at"
end
@ -224,10 +224,10 @@ ActiveRecord::Schema.define(version: 20190603130038) do
add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree
create_table "groups", force: :cascade do |t|
t.string "name"
t.string "name", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug"
t.string "slug", limit: 255
t.boolean "disabled"
end
@ -235,19 +235,19 @@ ActiveRecord::Schema.define(version: 20190603130038) do
create_table "history_values", force: :cascade do |t|
t.integer "setting_id"
t.integer "user_id"
t.string "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "footprint"
t.integer "invoicing_profile_id"
end
add_index "history_values", ["invoicing_profile_id"], name: "index_history_values_on_invoicing_profile_id", using: :btree
add_index "history_values", ["setting_id"], name: "index_history_values_on_setting_id", using: :btree
add_index "history_values", ["user_id"], name: "index_history_values_on_user_id", using: :btree
create_table "invoice_items", force: :cascade do |t|
t.integer "invoice_id"
t.string "stp_invoice_item_id"
t.string "stp_invoice_item_id", limit: 255
t.integer "amount"
t.datetime "created_at"
t.datetime "updated_at"
@ -261,16 +261,16 @@ ActiveRecord::Schema.define(version: 20190603130038) do
create_table "invoices", force: :cascade do |t|
t.integer "invoiced_id"
t.string "invoiced_type"
t.string "stp_invoice_id"
t.string "invoiced_type", limit: 255
t.string "stp_invoice_id", limit: 255
t.integer "total"
t.datetime "created_at"
t.datetime "updated_at"
t.string "reference"
t.string "avoir_mode"
t.string "reference", limit: 255
t.string "avoir_mode", limit: 255
t.datetime "avoir_date"
t.integer "invoice_id"
t.string "type"
t.string "type", limit: 255
t.boolean "subscription_to_expire"
t.text "description"
t.integer "wallet_amount"
@ -299,17 +299,17 @@ ActiveRecord::Schema.define(version: 20190603130038) do
add_index "invoicing_profiles", ["user_id"], name: "index_invoicing_profiles_on_user_id", using: :btree
create_table "licences", force: :cascade do |t|
t.string "name", null: false
t.string "name", limit: 255, null: false
t.text "description"
end
create_table "machines", force: :cascade do |t|
t.string "name", null: false
t.string "name", limit: 255, null: false
t.text "description"
t.text "spec"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug"
t.string "slug", limit: 255
t.boolean "disabled"
end
@ -326,14 +326,14 @@ ActiveRecord::Schema.define(version: 20190603130038) do
create_table "notifications", force: :cascade do |t|
t.integer "receiver_id"
t.integer "attached_object_id"
t.string "attached_object_type"
t.string "attached_object_type", limit: 255
t.integer "notification_type_id"
t.boolean "is_read", default: false
t.boolean "is_read", default: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "receiver_type"
t.boolean "is_send", default: false
t.jsonb "meta_data", default: {}
t.boolean "is_send", default: false
t.jsonb "meta_data", default: {}
end
add_index "notifications", ["notification_type_id"], name: "index_notifications_on_notification_type_id", using: :btree
@ -402,20 +402,20 @@ ActiveRecord::Schema.define(version: 20190603130038) do
add_index "organizations", ["invoicing_profile_id"], name: "index_organizations_on_invoicing_profile_id", using: :btree
create_table "plans", force: :cascade do |t|
t.string "name"
t.string "name", limit: 255
t.integer "amount"
t.string "interval"
t.string "interval", limit: 255
t.integer "group_id"
t.string "stp_plan_id"
t.string "stp_plan_id", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.integer "training_credit_nb", default: 0
t.boolean "is_rolling", default: true
t.integer "training_credit_nb", default: 0
t.boolean "is_rolling", default: true
t.text "description"
t.string "type"
t.string "base_name"
t.integer "ui_weight", default: 0
t.integer "interval_count", default: 1
t.integer "ui_weight", default: 0
t.integer "interval_count", default: 1
t.string "slug"
t.boolean "disabled"
end
@ -445,11 +445,11 @@ ActiveRecord::Schema.define(version: 20190603130038) do
create_table "profiles", force: :cascade do |t|
t.integer "user_id"
t.string "first_name"
t.string "last_name"
t.string "first_name", limit: 255
t.string "last_name", limit: 255
t.boolean "gender"
t.date "birthday"
t.string "phone"
t.string "phone", limit: 255
t.text "interest"
t.text "software_mastered"
t.datetime "created_at"
@ -479,7 +479,7 @@ ActiveRecord::Schema.define(version: 20190603130038) do
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "title"
t.string "title", limit: 255
t.integer "step_nb"
end
@ -490,27 +490,27 @@ ActiveRecord::Schema.define(version: 20190603130038) do
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "is_valid", default: false
t.string "valid_token"
t.boolean "is_valid", default: false
t.string "valid_token", limit: 255
end
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
create_table "projects", force: :cascade do |t|
t.string "name"
t.string "name", limit: 255
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "author_id"
t.text "tags"
t.integer "licence_id"
t.string "state"
t.string "slug"
t.string "state", limit: 255
t.string "slug", limit: 255
t.datetime "published_at"
end
add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true, using: :btree
add_index "projects", ["slug"], name: "index_projects_on_slug", using: :btree
create_table "projects_components", force: :cascade do |t|
t.integer "project_id"
@ -550,19 +550,19 @@ ActiveRecord::Schema.define(version: 20190603130038) do
t.datetime "created_at"
t.datetime "updated_at"
t.integer "reservable_id"
t.string "reservable_type"
t.string "stp_invoice_id"
t.string "reservable_type", limit: 255
t.string "stp_invoice_id", limit: 255
t.integer "nb_reserve_places"
end
add_index "reservations", ["reservable_type", "reservable_id"], name: "index_reservations_on_reservable_type_and_reservable_id", using: :btree
add_index "reservations", ["reservable_id", "reservable_type"], name: "index_reservations_on_reservable_id_and_reservable_type", 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
create_table "roles", force: :cascade do |t|
t.string "name"
t.string "name", limit: 255
t.integer "resource_id"
t.string "resource_type"
t.string "resource_type", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
@ -636,18 +636,18 @@ ActiveRecord::Schema.define(version: 20190603130038) do
create_table "statistic_fields", force: :cascade do |t|
t.integer "statistic_index_id"
t.string "key"
t.string "label"
t.string "key", limit: 255
t.string "label", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.string "data_type"
t.string "data_type", limit: 255
end
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|
t.integer "statistic_index_id"
t.string "chart_type"
t.string "chart_type", limit: 255
t.integer "limit"
t.datetime "created_at"
t.datetime "updated_at"
@ -656,17 +656,17 @@ ActiveRecord::Schema.define(version: 20190603130038) do
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|
t.string "es_type_key"
t.string "label"
t.string "es_type_key", limit: 255
t.string "label", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "table", default: true
t.boolean "ca", default: true
t.boolean "table", default: true
t.boolean "ca", default: true
end
create_table "statistic_sub_types", force: :cascade do |t|
t.string "key"
t.string "label"
t.string "key", limit: 255
t.string "label", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
@ -683,8 +683,8 @@ ActiveRecord::Schema.define(version: 20190603130038) do
create_table "statistic_types", force: :cascade do |t|
t.integer "statistic_index_id"
t.string "key"
t.string "label"
t.string "key", limit: 255
t.string "label", limit: 255
t.boolean "graph"
t.datetime "created_at"
t.datetime "updated_at"
@ -702,7 +702,7 @@ ActiveRecord::Schema.define(version: 20190603130038) do
create_table "subscriptions", force: :cascade do |t|
t.integer "plan_id"
t.integer "user_id"
t.string "stp_subscription_id"
t.string "stp_subscription_id", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "expiration_date"
@ -721,7 +721,7 @@ ActiveRecord::Schema.define(version: 20190603130038) do
add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
create_table "themes", force: :cascade do |t|
t.string "name", null: false
t.string "name", limit: 255, null: false
end
create_table "tickets", force: :cascade do |t|
@ -736,13 +736,13 @@ ActiveRecord::Schema.define(version: 20190603130038) do
add_index "tickets", ["reservation_id"], name: "index_tickets_on_reservation_id", using: :btree
create_table "trainings", force: :cascade do |t|
t.string "name"
t.string "name", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.integer "nb_total_places"
t.string "slug"
t.string "slug", limit: 255
t.text "description"
t.boolean "public_page", default: true
t.boolean "public_page", default: true
t.boolean "disabled"
end
@ -798,31 +798,31 @@ ActiveRecord::Schema.define(version: 20190603130038) do
add_index "user_trainings", ["user_id"], name: "index_user_trainings_on_user_id", using: :btree
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.string "email", limit: 255, default: "", null: false
t.string "encrypted_password", limit: 255, default: "", null: false
t.string "reset_password_token", limit: 255
t.datetime "reset_password_sent_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 "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "confirmation_token"
t.string "current_sign_in_ip", limit: 255
t.string "last_sign_in_ip", limit: 255
t.string "confirmation_token", limit: 255
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.integer "failed_attempts", default: 0, null: false
t.string "unlock_token"
t.string "unconfirmed_email", limit: 255
t.integer "failed_attempts", default: 0, null: false
t.string "unlock_token", limit: 255
t.datetime "locked_at"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "is_allow_contact", default: true
t.boolean "is_allow_contact", default: true
t.integer "group_id"
t.string "stp_customer_id"
t.string "username"
t.string "slug"
t.boolean "is_active", default: true
t.string "stp_customer_id", limit: 255
t.string "username", limit: 255
t.string "slug", limit: 255
t.boolean "is_active", default: true
t.string "provider"
t.string "uid"
t.string "auth_token"
@ -892,8 +892,8 @@ ActiveRecord::Schema.define(version: 20190603130038) do
add_foreign_key "events_event_themes", "event_themes"
add_foreign_key "events_event_themes", "events"
add_foreign_key "exports", "users"
add_foreign_key "history_values", "invoicing_profiles"
add_foreign_key "history_values", "settings"
add_foreign_key "history_values", "users"
add_foreign_key "invoices", "coupons"
add_foreign_key "invoices", "invoicing_profiles"
add_foreign_key "invoices", "users", column: "operator_id"

File diff suppressed because one or more lines are too long

View File

@ -60,6 +60,9 @@ class InvoicesTest < ActionDispatch::IntegrationTest
assert_equal 4, refund[:items][0][:invoice_item_id]
assert_match %r{^[0-9]+/A$}, refund[:reference]
assert_equal 'Lorem ipsum', avoir.description
# Check footprint
assert avoir.check_footprint
end
test 'admin fails generates a refund in closed period' do

View File

@ -57,12 +57,14 @@ module Reservations
refute invoice.stp_invoice_id.blank?
refute invoice.total.blank?
assert invoice.check_footprint
# invoice_items assertions
invoice_item = InvoiceItem.last
assert invoice_item.stp_invoice_item_id
assert_equal invoice_item.amount, machine.prices.find_by(group_id: @user_without_subscription.group_id, plan_id: nil).amount
assert invoice_item.check_footprint
# invoice assertions
invoice = Invoice.find_by(invoiced: reservation)
@ -159,11 +161,14 @@ module Reservations
refute invoice.stp_invoice_id.blank?
refute invoice.total.blank?
assert invoice.check_footprint
# invoice_items
invoice_item = InvoiceItem.last
assert invoice_item.stp_invoice_item_id
assert_equal invoice_item.amount, training.amount_by_group(@user_without_subscription.group_id).amount
assert invoice_item.check_footprint
# invoice assertions
invoice = Invoice.find_by(invoiced: reservation)
@ -230,6 +235,7 @@ module Reservations
refute invoice.stp_invoice_id.blank?
refute invoice.total.blank?
assert invoice.check_footprint
# invoice_items assertions
invoice_items = InvoiceItem.last(2)
@ -238,6 +244,7 @@ module Reservations
assert(invoice_items.any? { |inv| inv.amount.zero? })
assert(invoice_items.any? { |inv| inv.amount == machine_price })
assert(invoice_items.all?(&:stp_invoice_item_id))
assert(invoice_items.all?(&:check_footprint))
# users_credits assertions
users_credit = UsersCredit.last
@ -304,11 +311,14 @@ module Reservations
refute invoice.stp_invoice_id.blank?
refute invoice.total.blank?
assert invoice.check_footprint
# invoice_items
invoice_item = InvoiceItem.last
assert invoice_item.stp_invoice_item_id
assert_equal 0, invoice_item.amount # amount is 0 because this training is a credited training with that plan
assert invoice_item.check_footprint
# invoice assertions
invoice = Invoice.find_by(invoiced: reservation)
@ -374,12 +384,14 @@ module Reservations
refute invoice.stp_invoice_id.blank?
refute invoice.total.blank?
assert invoice.check_footprint
# invoice_items assertions
invoice_item = InvoiceItem.last
assert invoice_item.stp_invoice_item_id
assert_equal invoice_item.amount, machine.prices.find_by(group_id: @vlonchamp.group_id, plan_id: nil).amount
assert invoice_item.check_footprint
# invoice assertions
invoice = Invoice.find_by(invoiced: reservation)
@ -452,6 +464,7 @@ module Reservations
refute invoice.stp_invoice_id.blank?
refute invoice.total.blank?
assert_equal invoice.total, 2000
assert invoice.check_footprint
# invoice assertions
invoice = Invoice.find_by(invoiced: reservation)
@ -527,6 +540,7 @@ module Reservations
refute invoice.stp_invoice_id.blank?
refute invoice.total.blank?
assert invoice.check_footprint
# invoice_items assertions
## reservation
@ -535,6 +549,7 @@ module Reservations
assert_not_nil reservation_item
assert reservation_item.stp_invoice_item_id
assert_equal reservation_item.amount, machine.prices.find_by(group_id: @user_without_subscription.group_id, plan_id: plan.id).amount
assert reservation_item.check_footprint
## subscription
subscription_item = invoice.invoice_items.where.not(subscription_id: nil).first
@ -545,6 +560,7 @@ module Reservations
assert subscription_item.stp_invoice_item_id
assert_equal subscription_item.amount, plan.amount
assert_equal subscription.plan_id, plan.id
assert subscription_item.check_footprint
# invoice assertions
invoice = Invoice.find_by(invoiced: reservation)

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'test_helper'
class HistoryValueTest < ActiveSupport::TestCase
test 'an HistoryValue must be chained with a valid footprint' do
s = Setting.first
u = User.admins.first
hv = HistoryValue.new(setting: s, invoicing_profile: u.invoicing_profile, value: '1, 2, testing ...')
hv.save!
assert hv.check_footprint
end
end

View File

@ -1,14 +1,22 @@
# frozen_string_literal: true
require 'test_helper'
class OrganizationTest < ActiveSupport::TestCase
test 'an organization with name and address is valid' do
a = Address.new(address: '14 avenue du Maréchal Tartanpion, 12345 Saint-Robert-sur-Mer')
o = Organization.new(name: 'Menuiserie G. Dubois', address: a)
assert o.valid?
end
test 'organization must have a name' do
a = Address.new({address: '14 avenue du Maréchal Tartanpion, 12345 Saint-Robert-sur-Mer'})
o = Organization.new({address: a})
a = Address.new(address: '14 avenue du Maréchal Tartanpion, 12345 Saint-Robert-sur-Mer')
o = Organization.new(address: a)
assert o.invalid?
end
test 'organization must have an address' do
o = Organization.new({name: 'Menuiserie G. Dubois'})
o = Organization.new(name: 'Menuiserie G. Dubois')
assert o.invalid?
end
end

View File

@ -1,7 +0,0 @@
require 'test_helper'
class ValueHistoryTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end