<feed xmlns='http://www.w3.org/2005/Atom'>
<title>chouette-core/spec/models/referential, branch 5505-custom_fields</title>
<subtitle>Chouette manage transport static data</subtitle>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/'/>
<entry>
<title>referential_lock_during_creation_spec: Skip truncation tests</title>
<updated>2017-12-13T16:46:07+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-12-13T16:33:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=a9557b7f042dd25c56d0af75d55fadb63e862a26'/>
<id>a9557b7f042dd25c56d0af75d55fadb63e862a26</id>
<content type='text'>
Just discussed this with Alban. The truncation tests are breaking the
test suite, and I've spent way too long on this already. Take the specs
out of the suite for now until we can come up with a different way to
run these or test this behaviour without breaking everything.

The new task to fix this is #5295.

Refs #5024
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Just discussed this with Alban. The truncation tests are breaking the
test suite, and I've spent way too long on this already. Take the specs
out of the suite for now until we can come up with a different way to
run these or test this behaviour without breaking everything.

The new task to fix this is #5295.

Refs #5024
</pre>
</div>
</content>
</entry>
<entry>
<title>referential_lock_during_creation_spec: Make truncation strategy stick</title>
<updated>2017-12-13T16:01:15+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-12-13T16:01:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=bd8a999b12963b7303500ce93449bb7932afeec3'/>
<id>bd8a999b12963b7303500ce93449bb7932afeec3</id>
<content type='text'>
The `truncation: true` strategy wasn't sticking. The config `before`
block only ran once for this test file. Instead of attaching the filter
to the `it` blocks, put it on the `context`. This correctly gets each
test to run in a transaction.

Remove the `truncation: false` filter I had added previously as this
didn't do what I wanted it to: it prevented the `before` block from
running instead of filtering out tests with `truncation: true`.

Refs #5024
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `truncation: true` strategy wasn't sticking. The config `before`
block only ran once for this test file. Instead of attaching the filter
to the `it` blocks, put it on the `context`. This correctly gets each
test to run in a transaction.

Remove the `truncation: false` filter I had added previously as this
didn't do what I wanted it to: it prevented the `before` block from
running instead of filtering out tests with `truncation: true`.

Refs #5024
</pre>
</div>
</content>
</entry>
<entry>
<title>referential_lock_during_creation_spec: Extract method for threads</title>
<updated>2017-12-13T14:16:03+00:00</updated>
<author>
<name>Johan Van Ryseghem</name>
</author>
<published>2017-12-13T14:12:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=c21bcff5849190d87a2f2869a0f4714de118cb15'/>
<id>c21bcff5849190d87a2f2869a0f4714de118cb15</id>
<content type='text'>
Refactor these tests to abstract the thread &amp; transaction creation &amp;
handling. Thread creation and joining can now live in one place apart
from the tests, and the tests have an interface to set up concurrent
referential saving.

Thanks to Johan for this refactor.

Refs #5024
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Refactor these tests to abstract the thread &amp; transaction creation &amp;
handling. Thread creation and joining can now live in one place apart
from the tests, and the tests have an interface to set up concurrent
referential saving.

Thanks to Johan for this refactor.

Refs #5024
</pre>
</div>
</content>
</entry>
<entry>
<title>referential_lock_during_creation_spec: Don't create unnecessary Ref</title>
<updated>2017-12-12T16:06:50+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-12-12T16:06:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=83a0f74b02d9dc2b3e1eb6b3f7c7c068148f0856'/>
<id>83a0f74b02d9dc2b3e1eb6b3f7c7c068148f0856</id>
<content type='text'>
The `referential_metadata` factory will create an associated referential
by default. This causes errors in our tests because we haven't cleaned
up the trailing referential.

Refs #5024
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `referential_metadata` factory will create an associated referential
by default. This causes errors in our tests because we haven't cleaned
up the trailing referential.

Refs #5024
</pre>
</div>
</content>
</entry>
<entry>
<title>Referential: Lock table on :update</title>
<updated>2017-12-12T16:01:49+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-12-12T16:01:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=df13a9b7b26b568b5edcea590a2e867d26580d22'/>
<id>df13a9b7b26b568b5edcea590a2e867d26580d22</id>
<content type='text'>
We had been locking the `referentials` table on :create, but we also
want to handle :update. Paired on this with Johan.

When I used:

    referential_2.metadatas &lt;&lt; metadata_2

the referential was saved. To add the metadata without automatically
saving the referential + metadata, Johan suggested using the nested
attribute method:

    referential_2.metadatas_attributes = [metadata_2.attributes]

This allows us to add the metadata and still use the `#save` method to
lock the table.

Also change the callback from `before_validation` to `before_save`
because

    before_validation :lock_table, on: [:create, :update]

didn't work. That caused an error in our `expect`, as the `be_valid`
triggered the lock callback. To enable the callback on both :create and
:update, use a `before_save` instead.

Refs #5024
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We had been locking the `referentials` table on :create, but we also
want to handle :update. Paired on this with Johan.

When I used:

    referential_2.metadatas &lt;&lt; metadata_2

the referential was saved. To add the metadata without automatically
saving the referential + metadata, Johan suggested using the nested
attribute method:

    referential_2.metadatas_attributes = [metadata_2.attributes]

This allows us to add the metadata and still use the `#save` method to
lock the table.

Also change the callback from `before_validation` to `before_save`
because

    before_validation :lock_table, on: [:create, :update]

didn't work. That caused an error in our `expect`, as the `be_valid`
triggered the lock callback. To enable the callback on both :create and
:update, use a `before_save` instead.

Refs #5024
</pre>
</div>
</content>
</entry>
<entry>
<title>Referential: Raise an error if the table lock times out</title>
<updated>2017-12-12T15:56:49+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-12-12T15:56:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=55b995531b2504792dfa1b0314b5cc5b55a775ac'/>
<id>55b995531b2504792dfa1b0314b5cc5b55a775ac</id>
<content type='text'>
Paired with Johan on this one. There's an internal timeout on our table
lock. If it's reached, an
`ActiveRecord::StatementInvalid&lt;PG::LockNotAvailable&gt;` error is raised.
Use a custom error instead by "overriding" `#save` with a method that
raises our custom error in that case instead. This will enable us to
provide a custom user-facing error in the event this happens.

Refs #5024
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Paired with Johan on this one. There's an internal timeout on our table
lock. If it's reached, an
`ActiveRecord::StatementInvalid&lt;PG::LockNotAvailable&gt;` error is raised.
Use a custom error instead by "overriding" `#save` with a method that
raises our custom error in that case instead. This will enable us to
provide a custom user-facing error in the event this happens.

Refs #5024
</pre>
</div>
</content>
</entry>
<entry>
<title>referential_lock spec: Don't create unnecessary referential</title>
<updated>2017-12-06T14:01:02+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-12-06T14:01:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=0ec72aa1ce6598f48943df33827a6d700ee15153'/>
<id>0ec72aa1ce6598f48943df33827a6d700ee15153</id>
<content type='text'>
The factory for `referential_metadata` was creating an unnecessary
`Referential` object since it has an association set up. This was
causing the test to fail because that referential's schema wasn't
getting cleaned in the `ensure` block. Don't create that referential to
avoid the error.

Refs #5024
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The factory for `referential_metadata` was creating an unnecessary
`Referential` object since it has an association set up. This was
causing the test to fail because that referential's schema wasn't
getting cleaned in the `ensure` block. Don't create that referential to
avoid the error.

Refs #5024
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge remote-tracking branch 'origin/master' into 5024-prevent-duplicate-referentials-from-being-created-during-parallel-db-transactions--rb201711271659</title>
<updated>2017-12-05T17:26:57+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-12-05T17:26:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=47181fd81105396b2db394958c39a6e40bc6f0f0'/>
<id>47181fd81105396b2db394958c39a6e40bc6f0f0</id>
<content type='text'>
Conflicts:
	app/models/referential.rb

A whitespace conflict in a place I don't even remember editing? Okaay.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Conflicts:
	app/models/referential.rb

A whitespace conflict in a place I don't even remember editing? Okaay.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fixes: #5179@1h; Referential Creation Enforces objectid_format from associated Workbench</title>
<updated>2017-12-05T14:52:44+00:00</updated>
<author>
<name>Robert</name>
</author>
<published>2017-12-05T14:52:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=b50bcb8d6d0da921c002afb550a8aa4dffa3c2f0'/>
<id>b50bcb8d6d0da921c002afb550a8aa4dffa3c2f0</id>
<content type='text'>
  - CR changes implemented
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  - CR changes implemented
</pre>
</div>
</content>
</entry>
<entry>
<title>Refs: #5179@1.25h; Referential Creation Enforces objectid_format from associated Workbench</title>
<updated>2017-12-05T11:19:42+00:00</updated>
<author>
<name>Robert</name>
</author>
<published>2017-12-05T10:37:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=642d2bd3a46a4b459acf18748dbfebf0cb6ca7df'/>
<id>642d2bd3a46a4b459acf18748dbfebf0cb6ca7df</id>
<content type='text'>
  - changed ObjectIdFormatterSupport as requested
  - respeced all defined cases
  - implemented respec

Missing:
  What to do in `define_default_attributes` if ref has no workbench and no `objectid_format`?
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  - changed ObjectIdFormatterSupport as requested
  - respeced all defined cases
  - implemented respec

Missing:
  What to do in `define_default_attributes` if ref has no workbench and no `objectid_format`?
</pre>
</div>
</content>
</entry>
</feed>
