docbrown/spec/models
gverger c7de0d762b Add let_it_be_readonly to avoid updating variables (#5407)
With let_it_be, we define variables that are created for the whole
context. In case we update them in an example, there might be a
discrepancy between the object and its value in the database, since the
database is cleaned between examples, but not the object itself.

This is what happened here with the `article` object. In one of the
tests, we update its organization, and in another, we reupdate it. The
problem is that the `article` object still thinks it has an
organization, but it has been cleaned in the database. So setting the
same organization id to the object doesn't trigger the SQL query, and
the article in the database still doesn't have an organization attached.

One solution is to use `reload: true` as a parameter of `let_it_be`: it
will reload the object from the database at the beginning of each test. To
make sure we don't have other dormant traps like this one, what I
propose is to either have `reload: true`, or to have the object
readonly to avoid getting to a difference between the object and its
database value.
2020-01-16 10:53:30 -05:00
..
shared_examples Increase efficiency in models/article_spec.rb (#4882) [deploy] 2019-11-26 10:32:39 -05:00
webhook Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
api_secret_spec.rb ApiSecret model for Developer API (#1369) 2019-01-08 12:30:54 -05:00
application_record_spec.rb ActiveRecord count optimizations (#5478) [deploy] 2020-01-14 12:03:38 -05:00
article_destroy_spec.rb Migrate Articles/BustMultipleCachesJob to Sidekiq (#5309) [deploy] 2020-01-06 13:42:34 -05:00
article_spec.rb Rubocop fixes (#5244) 2019-12-26 11:52:36 -05:00
audit_log_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
backup_data_spec.rb Add functionality to remove and recover identity (#3377) 2019-07-03 12:01:16 -04:00
badge_achievement_spec.rb use new_badge_achievement_worker instead of active job (#5358) [deploy] 2020-01-07 08:16:17 -05:00
badge_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
block_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
buffer_update_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
chat_channel_spec.rb Destroy messages if chat channels are destroyed (#5498) 2020-01-14 09:46:40 -06:00
classified_listing_spec.rb Remove special characters in tags for articles created via API (#4239) [deploy] 2019-12-13 11:29:02 -05:00
collection_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
comment_spec.rb Migrate Comments::BustCacheJob to Comments::BustCacheWorker and move to Sidekiq (#5502) 2020-01-16 10:20:13 -05:00
credit_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
display_ad_event_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
display_ad_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
event_spec.rb Move Events::BustCacheJob to Sidekiq and rename (#5379) 2020-01-06 15:51:46 -05:00
feedback_message_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
follow_spec.rb Remove TouchFollowerJob and do user update inline (#5391) [deploy] 2020-01-08 14:12:04 -05:00
github_issue_spec.rb Bump octokit from 4.8.0 to 4.12.0 (#744) [ci skip] 2018-09-25 17:04:58 -04:00
github_repo_spec.rb Upgrade Rubocop related gems and fix new violations (#3581) [ci skip] 2019-07-30 14:29:05 -04:00
html_variant_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
html_variant_success_spec.rb Unskip all skipped specs (#2941) 2019-05-25 11:04:38 -04:00
html_variant_trial_spec.rb Unskip all skipped specs (#2941) 2019-05-25 11:04:38 -04:00
identity_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
job_opportunity_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
mention_spec.rb Add Mentions::CreateAllWorker for Sidekiq (#5463) 2020-01-13 13:23:30 -06:00
message_spec.rb Open /connect sidecar links in iframe (#5203) [deploy] 2019-12-21 15:46:36 -05:00
note_spec.rb Improve specs (#1693) 2019-02-04 15:56:00 -04:00
notification_spec.rb Add let_it_be_readonly to avoid updating variables (#5407) 2020-01-16 10:53:30 -05:00
notification_subscription_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
organization_membership_spec.rb Allow users to belong to multiple orgs (#2583) 2019-06-04 09:30:52 -04:00
organization_spec.rb Fixed rubocop issues (#5506) 2020-01-14 09:45:26 -06:00
page_spec.rb pages bust cache job sidekiq refactor (#5338) [deploy] 2020-01-02 15:16:09 -05:00
page_view_spec.rb Asynchronously Update Algolia after a PageView Update (#5076) [deploy] 2019-12-13 14:07:33 -06:00
podcast_episode_spec.rb Move Podcast Episode Bust Cache Job to Sidekiq (#5416) [deploy] 2020-01-10 10:08:59 -06:00
podcast_spec.rb Creating podcasts by users (#3730) [deploy] 2020-01-08 16:14:25 -05:00
poll_option_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
poll_skip_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
poll_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
poll_vote_spec.rb Upgrade Rubocop related gems and fix new violations (#3581) [ci skip] 2019-07-30 14:29:05 -04:00
pro_membership_spec.rb Fix pro_membership_spec's lint (#4193) [ci skip] 2019-10-02 13:04:43 -04:00
profile_pin_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
rating_vote_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
reaction_spec.rb Remove TouchJob and do it Inline (#5410) 2020-01-09 17:22:09 -05:00
role_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
sponsorship_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
tag_adjustment_spec.rb ensure that article tag_list always has more than 3 tags by stubbing the method (#5263) 2019-12-27 10:04:21 -06:00
tag_spec.rb Remove special characters in tags for articles created via API (#4239) [deploy] 2019-12-13 11:29:02 -05:00
tweet_spec.rb Upgrade Rubocop related gems and fix new violations (#3581) [ci skip] 2019-07-30 14:29:05 -04:00
user_block_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
user_spec.rb Fixed rubocop issues (#5506) 2020-01-14 09:45:26 -06:00