card 1.96.7 → 1.96.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/db/migrate_core_cards/20120611203506_rails_inflection_updates.rb +2 -2
  4. data/db/migrate_core_cards/20130823192433_add_style_cards.rb +5 -5
  5. data/db/migrate_core_cards/20130910183318_move_styles_to_content.rb +1 -1
  6. data/db/migrate_core_cards/20130920291703_update_stylesheets.rb +1 -1
  7. data/db/migrate_core_cards/20131016172445_common_css_patch.rb +1 -1
  8. data/db/migrate_core_cards/20140110193325_reset_account_request_type.rb +1 -1
  9. data/db/migrate_core_cards/20140307231621_user_data_to_cards.rb +1 -1
  10. data/db/migrate_core_cards/20140512155840_add_script_cards.rb +1 -1
  11. data/db/migrate_core_cards/20140629222005_add_email_cards.rb +2 -2
  12. data/db/migrate_core_cards/20141120120605_fix_notification_html_message.rb +1 -1
  13. data/db/migrate_core_cards/20141204061304_watchers_to_following.rb +1 -1
  14. data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +4 -4
  15. data/db/migrate_core_cards/20150317162412_bootstrap_themes.rb +1 -1
  16. data/db/migrate_core_cards/20150326205655_bootswatch_themes.rb +3 -3
  17. data/db/migrate_core_cards/20150331135745_new_card_menu.rb +1 -1
  18. data/db/migrate_core_cards/20150501010515_responsive_sidebar.rb +1 -1
  19. data/db/migrate_core_cards/20150510031118_fix_skin_codenames.rb +1 -1
  20. data/db/migrate_core_cards/20150610180019_add_recaptcha_key_and_admin_info_cards.rb +1 -1
  21. data/db/migrate_core_cards/20150627205133_fix_script_bootstrap_card_type.rb +1 -1
  22. data/db/migrate_core_cards/20150702130543_remove_edit_toolbar_pinned.rb +1 -1
  23. data/db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb +2 -2
  24. data/db/migrate_core_cards/20150824135418_update_file_history.rb +1 -1
  25. data/db/migrate_core_cards/20150910085603_remove_performance_log_card.rb +1 -1
  26. data/db/migrate_core_cards/20160801143221_change_bootstrap_card_type_to_scss.rb +1 -1
  27. data/db/migrate_core_cards/20160811115836_rename_stats_to_admin.rb +1 -1
  28. data/db/migrate_core_cards/20170830210517_correct_signup_success_message.rb +1 -1
  29. data/db/migrate_core_cards/data/1.12_stylesheets/traditional.scss +0 -9
  30. data/db/seed/test/seed.rb +3 -3
  31. data/lib/card/act_manager.rb +1 -1
  32. data/lib/card/cache.rb +5 -1
  33. data/lib/card/codename.rb +1 -1
  34. data/lib/card/model/save_helper.rb +3 -4
  35. data/lib/card/query.rb +15 -9
  36. data/lib/card/query/abstract_query/tie.rb +1 -0
  37. data/lib/card/query/card_query/interpretation.rb +1 -1
  38. data/lib/card/query/card_query/match_attributes.rb +2 -2
  39. data/lib/card/query/card_query/normalization.rb +6 -3
  40. data/lib/card/query/value.rb +3 -2
  41. data/lib/card/set/event/delayed_event.rb +1 -0
  42. data/mod/account/set/right/account.rb +4 -12
  43. data/mod/account/set/type/signup.rb +4 -0
  44. data/mod/account/spec/set/all/account_spec.rb +3 -3
  45. data/mod/account/spec/set/right/account_spec.rb +27 -20
  46. data/mod/account/spec/set/right/email_spec.rb +3 -3
  47. data/mod/account/spec/set/right/password_spec.rb +4 -5
  48. data/mod/account/spec/set/self/signin_spec.rb +8 -9
  49. data/mod/account/spec/set/type/signup_spec.rb +3 -3
  50. data/mod/admin/spec/set/self/admin_spec.rb +4 -4
  51. data/mod/bootstrap/db/migrate_core_cards/20180423160231_migrate_customized_bootstrap_skin.rb +2 -2
  52. data/mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb +1 -1
  53. data/mod/bootstrap/db/migrate_core_cards/20180601133753_migrate_skins.rb +1 -1
  54. data/mod/bootstrap/db/migrate_core_cards/data/20181108181219_migrate_classic_skins_to_bootstrap.rb +2 -2
  55. data/mod/bootstrap/lib/stylesheets/style_bootstrap_cards.scss +3 -0
  56. data/mod/bootstrap/set/abstract/bootswatch_theme.rb +1 -1
  57. data/mod/bootstrap/spec/set/type/bootswatch_skin_spec.rb +1 -1
  58. data/mod/bootstrap/spec/set/type/customized_bootswatch_skin_spec.rb +1 -1
  59. data/mod/carrierwave/lib/carrier_wave/file_card_uploader.rb +2 -2
  60. data/mod/carrierwave/set/abstract/attachment.rb +1 -1
  61. data/mod/carrierwave/set/abstract/attachment/storage_type.rb +2 -2
  62. data/mod/carrierwave/set/abstract/attachment/upload_cache.rb +2 -2
  63. data/mod/carrierwave/spec/set/type/file_spec.rb +9 -12
  64. data/mod/carrierwave/spec/set/type/image_spec.rb +2 -2
  65. data/mod/core/set/all/actify.rb +5 -2
  66. data/mod/core/set/all/cache.rb +1 -1
  67. data/mod/core/set/all/content.rb +12 -30
  68. data/mod/core/set/all/contextual_content.rb +28 -0
  69. data/mod/core/set/all/name.rb +1 -1
  70. data/mod/core/set/all/rules.rb +1 -0
  71. data/mod/core/set/all/trash.rb +2 -2
  72. data/mod/core/set/all/utils.rb +2 -2
  73. data/mod/core/spec/set/all/actify_spec.rb +45 -2
  74. data/mod/core/spec/set/all/codename_spec.rb +2 -2
  75. data/mod/core/spec/set/all/event_conditions_spec.rb +15 -16
  76. data/mod/core/spec/set/all/name_events_spec.rb +2 -2
  77. data/mod/core/spec/set/all/observer_spec.rb +1 -1
  78. data/mod/core/spec/set/all/permissions_spec.rb +3 -3
  79. data/mod/core/spec/set/all/references_spec.rb +1 -1
  80. data/mod/core/spec/set/all/rename_spec.rb +2 -2
  81. data/mod/core/spec/set/all/trash_spec.rb +1 -1
  82. data/mod/follow/set/all/follow/follow_link.rb +7 -1
  83. data/mod/follow/spec/set/all/notify_spec.rb +2 -2
  84. data/mod/follow/spec/set/right/account_spec.rb +2 -2
  85. data/mod/follow/spec/set/right/followers_spec.rb +2 -2
  86. data/mod/follow/spec/set/self/follow_defaults_spec.rb +1 -1
  87. data/mod/follow/spec/set/type/notification_template_spec.rb +1 -1
  88. data/mod/history/set/all/history.rb +1 -1
  89. data/mod/history/set/all/history/act_listing.rb +2 -1
  90. data/mod/history/set/all/history/events.rb +3 -3
  91. data/mod/machines/lib/stylesheets/style_cards.scss +17 -16
  92. data/mod/machines/set/abstract/machine.rb +3 -2
  93. data/mod/machines/set/abstract/machine/output_cache.rb +1 -1
  94. data/mod/machines/set/abstract/machine_input.rb +1 -1
  95. data/mod/machines/spec/set/right/machine_cache_spec.rb +2 -2
  96. data/mod/machines/spec/set/type/skin_spec.rb +2 -2
  97. data/mod/pointer/spec/set/abstract/pointer/events_spec.rb +2 -2
  98. data/mod/search/set/abstract/01_filter_form_helper.rb +5 -1
  99. data/mod/search/set/abstract/search/views.rb +1 -1
  100. data/mod/settings/spec/set/right/comment_spec.rb +1 -1
  101. data/mod/solid_cache/set/right/solid_cache.rb +1 -1
  102. data/mod/solid_cache/spec/set/abstract/solid_cache_spec.rb +4 -4
  103. data/mod/standard/set/self/activity_toolbar_button.rb +1 -1
  104. data/mod/standard/spec/content/chunk/include_spec.rb +1 -1
  105. data/mod/standard/spec/set/all/history_spec.rb +5 -5
  106. data/mod/standard/spec/set/type/email_template/email_config_spec.rb +2 -2
  107. data/mod/standard/spec/set/type/list_spec.rb +9 -9
  108. data/mod/standard/spec/set/type/listed_by_spec.rb +9 -9
  109. data/mod/standard/spec/set/type/search_type_spec.rb +2 -3
  110. data/mod/virtual/lib/card/virtual.rb +1 -1
  111. data/mod/virtual/set/abstract/virtual_cache.rb +2 -2
  112. metadata +5 -4
@@ -27,7 +27,7 @@ class Skin
27
27
  # Card.search(refer_to: skin_name).each do |ref|
28
28
  # new_content = ref.content.gsub(/#{theme_name}[ _]skin/i,
29
29
  # "#{skin_name} customized")
30
- # card.update_attributes! content: new_content
30
+ # card.update! content: new_content
31
31
  # end
32
32
  # end
33
33
  end
@@ -59,7 +59,7 @@ class MigrateCustomizedBootstrapSkin < Card::Migration::Core
59
59
  def replace_old_skin referers
60
60
  referers.each do |ref|
61
61
  new_content = ref.content.gsub(/customizable[ _]bootstrap[ _]skin/i, NEW_SKIN)
62
- ref.update_attributes! content: new_content
62
+ ref.update! content: new_content
63
63
  end
64
64
  end
65
65
 
@@ -25,7 +25,7 @@ class AddTypeBootswatchSkin < Card::Migration::Core
25
25
  puts "updating #{skin_name}"
26
26
  card = Card.fetch(skin_name)
27
27
  next puts "card not found" unless card
28
- card.update_attributes! type_id: Card::BootswatchSkinID
28
+ card.update! type_id: Card::BootswatchSkinID
29
29
  end
30
30
  end
31
31
  end
@@ -4,7 +4,7 @@ class MigrateSkins < Card::Migration::Core
4
4
  def up
5
5
  Card.search(link_to: "bootstrap default skin", type_id: Card::SkinID) do |card|
6
6
  card.drop_item! "bootstrap default skin"
7
- card.update_attributes! type_id: Card::CustomizedBootswatchSkinID
7
+ card.update! type_id: Card::CustomizedBootswatchSkinID
8
8
  end
9
9
  end
10
10
  end
@@ -17,11 +17,11 @@ class MigrateClassicSkinsToBootstrap < ActiveRecord::Migration[5.2]
17
17
  def change
18
18
  style_rule = Card[:all, :style]
19
19
  if style_rule.item_names.first.key.in? UNSUPPORTED_SKINS
20
- style_rule.update_attributes! content: DEFAULT_SKIN
20
+ style_rule.update! content: DEFAULT_SKIN
21
21
  end
22
22
 
23
23
  layout_rule = Card[:all, :layout]
24
24
  return unless layout_rule.item_names.first.key == UNSUPPORTED_LAYOUT
25
- layout_rule.update_attributes! content: DEFAULT_LAYOUT
25
+ layout_rule.update! content: DEFAULT_LAYOUT
26
26
  end
27
27
  end
@@ -393,6 +393,9 @@ body.mceContentBody {
393
393
 
394
394
  .bar {
395
395
  border-left: 3px solid $bar_stripe_color !important;
396
+ .bar-nav {
397
+ min-width: 36px;
398
+ }
396
399
  }
397
400
 
398
401
  .box {
@@ -75,7 +75,7 @@ end
75
75
  # Don't create "+*machine output" file card
76
76
  # instead save the the output as the card's content is
77
77
  def after_engine output
78
- Card::Auth.as_bot { update_attributes! db_content: output }
78
+ Card::Auth.as_bot { update! db_content: output }
79
79
  end
80
80
 
81
81
  # needed to make the refresh_script_and_style method work with these cards
@@ -33,7 +33,7 @@ RSpec.describe Card::Set::Type::BootswatchSkin do
33
33
 
34
34
  context "when stylesheets item content changed" do
35
35
  it "updates output of related machine card", as_bot: true do
36
- customized_skin.field(:bootswatch).update_attributes! content: CUSTOM_CSS
36
+ customized_skin.field(:bootswatch).update! content: CUSTOM_CSS
37
37
  expect(generated_css).to include CUSTOM_CSS
38
38
  end
39
39
  end
@@ -23,7 +23,7 @@ RSpec.describe Card::Set::Type::CustomizedBootswatchSkin do
23
23
  example "update old skin", as_bot: true do
24
24
  create_skin "old skin", content: ["bootstrap default skin", "custom css"]
25
25
  card = Card["old skin"]
26
- card.update_attributes! type_id: Card::CustomizedBootswatchSkinID
26
+ card.update! type_id: Card::CustomizedBootswatchSkinID
27
27
 
28
28
  expect_card("old skin")
29
29
  .to have_a_field(:stylesheets).refering_to "custom css"
@@ -47,7 +47,7 @@ module CarrierWave
47
47
  # remote_file_url: "http://a.file.in/the.web"
48
48
  #
49
49
  # @example Updating a image card using a remote url
50
- # card.update_attributes remote_image_url: "http://a.image/somewhere.png"
50
+ # card.update remote_image_url: "http://a.image/somewhere.png"
51
51
  #
52
52
  # ## Storage types
53
53
  # You can choose between four different storage options
@@ -93,7 +93,7 @@ module CarrierWave
93
93
  # }
94
94
  #
95
95
  # # wagn console or rake task:
96
- # card.update_attributes storage_type: :cloud, bucket: :aws_bucket
96
+ # card.update storage_type: :cloud, bucket: :aws_bucket
97
97
  #
98
98
  # @example Creating a file card with fixed external link
99
99
  # Card.create name: "file card", type_id: Card::FileID,
@@ -20,7 +20,7 @@ end
20
20
 
21
21
  event :save_original_filename, :prepare_to_store, on: :save, when: :file_ready_to_save? do
22
22
  return unless @current_action
23
- @current_action.update_attributes! comment: original_filename
23
+ @current_action.update! comment: original_filename
24
24
  end
25
25
 
26
26
  event :validate_file_exist, :validate, on: :save do
@@ -31,8 +31,8 @@ event :validate_storage_type_update, :validate, on: :update do
31
31
  # FIXME: make it possible to retrieve the file from cloud storage
32
32
  # to store it somewhere else. Currently, it only works to change the
33
33
  # storage type if a new file is provided
34
- # i.e. `update_attributes storage_type: :local` fails but
35
- # `update_attributes storage_type: :local, file: [file handle]` is ok
34
+ # i.e. `update storage_type: :local` fails but
35
+ # `update storage_type: :local, file: [file handle]` is ok
36
36
  if cloud? && storage_type_changed? && !attachment_is_changing?
37
37
  errors.add :storage_type, tr(:moving_files_is_not_supported)
38
38
  end
@@ -14,7 +14,7 @@ event :prepare_attachment, :prepare_to_validate, on: :save, when: :preliminary_u
14
14
  # finalize_action # create Card::Change entry for db_content
15
15
 
16
16
  card_id = new_card? ? upload_cache_card.id : id
17
- @current_action.update_attributes! draft: true, card_id: card_id
17
+ @current_action.update! draft: true, card_id: card_id
18
18
  success << {
19
19
  target: (new_card? ? upload_cache_card : self),
20
20
  type: type_name,
@@ -42,7 +42,7 @@ end
42
42
  def assign_attachment file, original_filename
43
43
  send "#{attachment_name}=", file
44
44
  write_identifier
45
- @current_action.update_attributes! comment: original_filename if @current_action
45
+ @current_action&.update! comment: original_filename
46
46
  end
47
47
 
48
48
  event :delete_cached_upload_file_on_create, :integrate,
@@ -226,8 +226,7 @@ RSpec.describe Card::Set::Type::File do
226
226
  Card::Mod.dirs.mods.delete "test_mod"
227
227
  end
228
228
  subject do
229
- create_file_card :coded, test_file,
230
- codename: "mod_file", mod: "test_mod"
229
+ create_file_card :coded, test_file, codename: "mod_file", mod: "test_mod"
231
230
  end
232
231
 
233
232
  let(:file_path) { File.join mod_path, "file", "mod_file", "file.txt" }
@@ -329,7 +328,7 @@ RSpec.describe Card::Set::Type::File do
329
328
  context "updating" do
330
329
  subject do
331
330
  card = protected_file
332
- card.update_attributes! file: test_file(2)
331
+ card.update! file: test_file(2)
333
332
  card
334
333
  end
335
334
 
@@ -357,20 +356,19 @@ RSpec.describe Card::Set::Type::File do
357
356
  end
358
357
 
359
358
  subject do
360
- create_file_card :coded, test_file,
361
- codename: "mod_file", mod: "test_mod"
359
+ create_file_card :coded, test_file, codename: "mod_file", mod: "test_mod"
362
360
  end
363
361
 
364
362
  it "changes storage type to default" do
365
363
  storage_config :local
366
- subject.update_attributes! file: test_file(2)
364
+ subject.update! file: test_file(2)
367
365
  expect(subject.storage_type).to eq :local
368
366
  expect(subject.db_content)
369
367
  .to eq "~#{subject.id}/#{subject.last_action_id}.txt"
370
368
  end
371
369
  it "keeps storage type coded if explicitly set" do
372
370
  storage_config :local
373
- subject.update_attributes! file: test_file(2), storage_type: :coded
371
+ subject.update! file: test_file(2), storage_type: :coded
374
372
  expect(subject.storage_type).to eq :coded
375
373
  expect(subject.db_content)
376
374
  .to eq ":#{subject.codename}/test_mod.txt"
@@ -432,7 +430,7 @@ RSpec.describe Card::Set::Type::File do
432
430
  after { Cardio.config.file_storage = :local }
433
431
  it "copies file to local file system" do
434
432
  # not yet supported
435
- expect { Card[subject.name].update_attributes!(storage_type: :local) }
433
+ expect { Card[subject.name].update!(storage_type: :local) }
436
434
  .to raise_error(ActiveRecord::RecordInvalid)
437
435
  # expect(subject.content)
438
436
  # .to eq "~#{subject.id}/#{subject.last_action_id - 1}.txt"
@@ -454,8 +452,7 @@ RSpec.describe Card::Set::Type::File do
454
452
  expect(subject.db_content)
455
453
  .to eq "~#{subject.id}/#{subject.last_action_id}.txt"
456
454
  Card::Auth.as_bot do
457
- subject.update_attributes! storage_type: :coded, mod: "test_mod",
458
- codename: "mod_file"
455
+ subject.update! storage_type: :coded, mod: "test_mod", codename: "mod_file"
459
456
  end
460
457
  expect(subject.db_content)
461
458
  .to eq ":#{subject.codename}/test_mod.txt"
@@ -469,7 +466,7 @@ RSpec.describe Card::Set::Type::File do
469
466
  it "copies file to mod" do
470
467
  @storage_type = :local
471
468
  Card::Auth.as_bot do
472
- subject.update_attributes! storage_type: :local
469
+ subject.update! storage_type: :local
473
470
  end
474
471
  expect(subject.db_content)
475
472
  .to eq "~#{subject.id}/#{subject.last_action_id}.png"
@@ -481,7 +478,7 @@ RSpec.describe Card::Set::Type::File do
481
478
  @storage_type = :local
482
479
  expect(subject.db_content)
483
480
  .to eq "~#{subject.id}/#{subject.last_action_id}.txt"
484
- subject.update_attributes! storage_type: :cloud
481
+ subject.update! storage_type: :cloud
485
482
 
486
483
  expect(subject.db_content).to eq(
487
484
  "(test_bucket)/#{subject.id}/#{subject.last_action_id}.txt"
@@ -77,7 +77,7 @@ describe Card::Set::Type::Image do
77
77
 
78
78
  context "updated file card" do
79
79
  before do
80
- subject.update_attributes!(
80
+ subject.update!(
81
81
  image: File.new(File.join(CARD_TEST_SEED_PATH, "rails.gif"))
82
82
  )
83
83
  end
@@ -111,7 +111,7 @@ describe Card::Set::Type::Image do
111
111
 
112
112
  it "becomes a regular file when changed" do
113
113
  Card::Auth.as_bot do
114
- subject.update_attributes!(
114
+ subject.update!(
115
115
  image: File.new(File.join(CARD_TEST_SEED_PATH, "rails.gif"))
116
116
  )
117
117
  end
@@ -53,10 +53,13 @@ def valid?(*)
53
53
  act { super }
54
54
  end
55
55
 
56
- def update_attributes *args
56
+ def update *args
57
57
  act { super }
58
58
  end
59
59
 
60
- def update_attributes! *args
60
+ def update! *args
61
61
  act { super }
62
62
  end
63
+
64
+ alias_method :update_attributes, :update
65
+ alias_method :update_attributes!, :update!
@@ -113,4 +113,4 @@ end
113
113
  def expire_id cache
114
114
  return unless id.present?
115
115
  cache.delete "~#{id}"
116
- end
116
+ end
@@ -19,37 +19,10 @@ def structured_content
19
19
  structure && template.db_content
20
20
  end
21
21
 
22
- def context_card
23
- @context_card || self
24
- end
25
-
26
- def with_context context_card
27
- old_context = @context_card
28
- @context_card = context_card if context_card
29
- yield
30
- ensure
31
- @context_card = old_context
32
- end
33
-
34
22
  format do
35
23
  def chunk_list # override to customize by set
36
24
  :default
37
25
  end
38
-
39
- def context_card
40
- card.context_card
41
- end
42
-
43
- def with_context context_card
44
- card.with_context context_card do
45
- yield
46
- end
47
- end
48
-
49
- def contextual_content context_card, options={}
50
- view = options.delete(:view) || :core
51
- with_context(context_card) { render! view, options }
52
- end
53
26
  end
54
27
 
55
28
  format :html do
@@ -83,7 +56,7 @@ def last_draft_content
83
56
  end
84
57
 
85
58
  event :set_content, :store, on: :save do
86
- self.db_content = prepare_content
59
+ self.db_content = prepare_db_content
87
60
  @selected_action_id = @selected_content = nil
88
61
  clear_drafts
89
62
  reset_patterns_if_rule true
@@ -104,11 +77,20 @@ def draft?
104
77
  Env.params["draft"] == "true"
105
78
  end
106
79
 
107
- def prepare_content
108
- cont = standard_content || "" # necessary?
80
+ def prepare_db_content
81
+ cont = standard_db_content || "" # necessary?
109
82
  clean_html? ? Card::Content.clean!(cont) : cont
110
83
  end
111
84
 
85
+ def standard_db_content
86
+ if structure
87
+ # do not override db_content with content from structure
88
+ db_content
89
+ else
90
+ standard_content
91
+ end
92
+ end
93
+
112
94
  def clean_html?
113
95
  true
114
96
  end
@@ -0,0 +1,28 @@
1
+ def context_card
2
+ @context_card || self
3
+ end
4
+
5
+ def with_context context_card
6
+ old_context = @context_card
7
+ @context_card = context_card if context_card
8
+ yield
9
+ ensure
10
+ @context_card = old_context
11
+ end
12
+
13
+ format do
14
+ def context_card
15
+ card.context_card
16
+ end
17
+
18
+ def with_context context_card
19
+ card.with_context context_card do
20
+ yield
21
+ end
22
+ end
23
+
24
+ def contextual_content context_card, options={}
25
+ view = options.delete(:view) || :core
26
+ with_context(context_card) { render! view, options }
27
+ end
28
+ end
@@ -16,7 +16,7 @@ module ClassMethods
16
16
  end
17
17
 
18
18
  def rename! oldname, newname
19
- Card[oldname].update_attributes! name: newname, update_referers: true
19
+ Card[oldname].update! name: newname, update_referers: true
20
20
  end
21
21
  end
22
22
 
@@ -67,6 +67,7 @@ def is_standard_rule?
67
67
  l.type_id == Card::SetID
68
68
  end
69
69
 
70
+ # TODO: abstract so account doesn't have to have User type.
70
71
  def is_preference?
71
72
  name.parts.length > 2 &&
72
73
  (r = right(skip_modules: true)) &&
@@ -50,13 +50,13 @@ end
50
50
 
51
51
  def delete args={}
52
52
  add_to_trash args do |delete_args|
53
- update_attributes delete_args
53
+ update delete_args
54
54
  end
55
55
  end
56
56
 
57
57
  def delete! args={}
58
58
  add_to_trash args do |delete_args|
59
- update_attributes! delete_args
59
+ update! delete_args
60
60
  end
61
61
  end
62
62
 
@@ -54,11 +54,11 @@ end
54
54
  # sepaarte name and other attributes
55
55
  def safe_update! attribs
56
56
  separate_name_update! attribs.delete("name") unless new?
57
- update_attributes! attribs if attribs.present?
57
+ update! attribs if attribs.present?
58
58
  end
59
59
 
60
60
  def separate_name_update! new_name
61
61
  return if new_name.to_s == name.to_s
62
62
 
63
- update_attributes! name: new_name
63
+ update! name: new_name
64
64
  end
@@ -10,6 +10,49 @@ RSpec.describe "act API" do
10
10
  }
11
11
  end
12
12
 
13
+ describe "#act" do
14
+ let(:card) { Card["A"] }
15
+
16
+ before do
17
+ allow(card).to receive(:act).and_return nil
18
+ end
19
+
20
+ it "is called by valid?" do
21
+ card.valid?
22
+ expect(card).to have_received :act
23
+ end
24
+
25
+ it "is called by #save!" do
26
+ card.save!
27
+ expect(card).to have_received :act
28
+ end
29
+
30
+ it "is called by #save" do
31
+ card.save
32
+ expect(card).to have_received :act
33
+ end
34
+
35
+ it "is called by #update" do
36
+ card.update content: "A"
37
+ expect(card).to have_received :act
38
+ end
39
+
40
+ it "is called by #update!" do
41
+ card.update! content: "A"
42
+ expect(card).to have_received :act
43
+ end
44
+
45
+ it "is called by #update_attributes" do
46
+ card.update_attributes content: "A"
47
+ expect(card).to have_received :act
48
+ end
49
+
50
+ it "is called by #update_attributes!" do
51
+ card.update_attributes! content: "A"
52
+ expect(card).to have_received :act
53
+ end
54
+ end
55
+
13
56
  describe "add subcards" do
14
57
  def save_transaction
15
58
  @trans = ActiveRecord::Base.connection.current_transaction
@@ -149,7 +192,7 @@ RSpec.describe "act API" do
149
192
  expect(name_before_act).to eq("A")
150
193
  expect(db_content_before_act).to eq("Alpha [[Z]]")
151
194
  end
152
- Card["A"].update_attributes! name: "new name"
195
+ Card["A"].update! name: "new name"
153
196
  Delayed::Worker.new.work_off
154
197
  end
155
198
  end
@@ -173,7 +216,7 @@ RSpec.describe "act API" do
173
216
  test_event :integrate_with_delay, changed: :content do
174
217
  event_called :iwd_content
175
218
  end
176
- Card["A"].update_attributes! name: "new name"
219
+ Card["A"].update! name: "new name"
177
220
  Delayed::Worker.new.work_off
178
221
  expect(@called_events).to eq(%i[i_name iwd_name])
179
222
  end