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
@@ -36,13 +36,19 @@ class Card
36
36
  module Query
37
37
  require_dependency "card/query/card_query"
38
38
 
39
+ # After conversion, ATTRIBUTES is a Hash where the key is the attribute
40
+ # and the value is the attribute type:
41
+ # { id: :basic, name: :basic, key: :basic ...}
42
+ # This is used for rapid attribute type lookups in the interpretation phase.
39
43
  ATTRIBUTES = {
40
44
  # Each of the "basic" fields corresponds directly to a database field.
41
- # their values are translated fairly directly into SQL-safe values
42
- basic: %w[id name key type_id content left_id right_id
45
+ # their values are translated fairly directly into SQL-safe values.
46
+ # (These are referred to as "properties" in WQL documentation. Need to
47
+ # reconcile #EFM)
48
+ basic: %i[id name key type_id content left_id right_id
43
49
  creator_id updater_id codename read_rule_id],
44
50
  # "Relational" values can involve tying multiple queries together
45
- relational: %w[type
51
+ relational: %i[type
46
52
  part left right
47
53
  editor_of edited_by last_editor_of last_edited_by
48
54
  creator_of created_by
@@ -56,17 +62,17 @@ class Card
56
62
  found_by not sort match name_match complete
57
63
  extension_type],
58
64
 
59
- plus_relational: %w[plus left_plus right_plus],
60
- conjunction: %w[and or all any],
61
- ignore: %w[prepend append view params vars size]
65
+ plus_relational: %i[plus left_plus right_plus],
66
+ conjunction: %i[and or all any],
67
+ ignore: %i[prepend append view params vars size]
62
68
  }.each_with_object({}) do |pair, h|
63
- pair[1].each { |v| h[v.to_sym] = pair[0] }
69
+ pair[1].each { |v| h[v] = pair[0] }
64
70
  end
65
71
 
66
72
  CONJUNCTIONS = { any: :or, in: :or, or: :or, all: :and, and: :and }.freeze
67
73
 
68
- MODIFIERS = %w(conj return sort sort_as group dir limit offset)
69
- .each_with_object({}) { |v, h| h[v.to_sym] = nil }
74
+ MODIFIERS = %i[conj return sort sort_as group dir limit offset]
75
+ .each_with_object({}) { |v, h| h[v] = nil }
70
76
 
71
77
  OPERATORS =
72
78
  %w(!= = =~ < > in ~).each_with_object({}) { |v, h| h[v] = v }.merge(
@@ -95,6 +95,7 @@ class Card
95
95
  case val
96
96
  when Integer then val
97
97
  when String then Card.fetch_id(val)
98
+ when Symbol then Card::Codename.id(val)
98
99
  end
99
100
  end
100
101
  end
@@ -58,7 +58,7 @@ class Card
58
58
  end
59
59
 
60
60
  def bad_attribute! attribute
61
- raise Card::Error::BadQuery, "Invalid attribute #{attribute}"
61
+ raise Error::BadQuery, "Invalid attribute: #{attribute}"
62
62
  end
63
63
 
64
64
  def relate_compound key, val
@@ -49,9 +49,9 @@ class Card
49
49
  end
50
50
 
51
51
  # TODO: move sql to SqlStatement
52
- def key_like pattern, no_junction=false
52
+ def key_like pattern, junction_ok=true
53
53
  conds = ["#{table_alias}.key LIKE #{quote pattern}"]
54
- conds << "#{table_alias}.right_id is null" if no_junction
54
+ conds << "#{table_alias}.right_id is null" unless junction_ok
55
55
  # FIXME: -- this should really be more nuanced --
56
56
  # it includes all descendants after one plus
57
57
  conds.join " AND "
@@ -8,6 +8,8 @@ class Card
8
8
  clause.symbolize_keys!
9
9
  clause.each do |key, val|
10
10
  next if key.to_sym == :return
11
+ # when return values are relative, they are relative to the name of the
12
+ # card returned, not the context card
11
13
  clause[key] = normalize_value val
12
14
  end
13
15
  clause
@@ -18,16 +20,17 @@ class Card
18
20
  when Hash then clause
19
21
  when String then { key: clause.to_name.key }
20
22
  when Integer then { id: clause }
21
- else raise Card::Error::BadQuery, "Invalid query args #{clause.inspect}"
23
+ when Symbol then { id: Card::Codename.id(clause) }
24
+ else raise Error::BadQuery, "Invalid clause: #{clause.inspect}"
22
25
  end
23
26
  end
24
27
 
25
28
  def normalize_value val
26
29
  case val
27
- when Integer, Float, Symbol, Hash then val
30
+ when Integer, Float, Hash, Symbol then val
28
31
  when String then normalize_string_value val
29
32
  when Array then normalize_array_value val
30
- else raise Card::Error::BadQuery, "unknown WQL value type: #{val.class}"
33
+ else raise Error::BadQuery, "Invalid value type: #{val.class} (#{val.inspect})"
31
34
  end
32
35
  end
33
36
 
@@ -15,8 +15,9 @@ class Card
15
15
  def parse_value rawvalue
16
16
  case rawvalue
17
17
  when String, Integer then ["=", rawvalue]
18
+ when Symbol then ["=", rawvalue.to_s]
18
19
  when Array then parse_array_value rawvalue
19
- else raise("Invalid Condition Clause #{rawvalue}.inspect}")
20
+ else raise Error::BadQuery, "Invalid property value: #{rawvalue.inspect}"
20
21
  end
21
22
  end
22
23
 
@@ -27,7 +28,7 @@ class Card
27
28
 
28
29
  def canonicalize_operator
29
30
  unless (target = OPERATORS[@operator.to_s])
30
- raise Card::Error::BadQuery, "Invalid Operator #{@operator}"
31
+ raise Error::BadQuery, "Invalid operator: #{@operator}"
31
32
  end
32
33
  @operator = target
33
34
  end
@@ -35,6 +35,7 @@ class Card
35
35
 
36
36
  class IntegrateWithDelayJob < ApplicationJob
37
37
  def perform act_id, card, card_attribs, env, auth, method_name
38
+ Card::Cache.renew_persistent
38
39
  card.deserialize_for_active_job! card_attribs
39
40
  ActManager.contextualize_delayed_event act_id, card, env, auth do
40
41
  card.send method_name
@@ -27,7 +27,7 @@ event :set_default_salt, :prepare_to_validate, on: :create do
27
27
  end
28
28
 
29
29
  event :set_default_status, :prepare_to_validate, on: :create do
30
- default_status = Auth.needs_setup? ? "active" : "pending"
30
+ default_status = left&.try(:default_account_status) || "active"
31
31
  add_subfield :status, content: default_status
32
32
  end
33
33
 
@@ -54,7 +54,7 @@ end
54
54
 
55
55
  event :reset_token do
56
56
  token = generate_token
57
- Auth.as_bot { token_card.update_attributes! content: token }
57
+ Auth.as_bot { token_card.update! content: token }
58
58
  token
59
59
  end
60
60
 
@@ -65,7 +65,7 @@ end
65
65
 
66
66
  event :send_reset_password_token do
67
67
  Auth.as_bot do
68
- token_card.update_attributes! content: generate_token
68
+ token_card.update! content: generate_token
69
69
  end
70
70
  Card[:password_reset_email].deliver self, to: email
71
71
  end
@@ -180,16 +180,8 @@ format :html do
180
180
  {{+#{:password.cardname}|titled;title:password}})
181
181
  end
182
182
 
183
- view :edit do
184
- voo.structure = true
183
+ before :content_formgroup do
185
184
  voo.edit_structure = [[:email, "email"], [:password, "password"]]
186
- super()
187
- end
188
-
189
- view :edit_in_form do
190
- voo.structure = true
191
- voo.edit_structure = [[:email, "email"], [:password, "password"]]
192
- super()
193
185
  end
194
186
  end
195
187
 
@@ -105,6 +105,10 @@ format :html do
105
105
  end
106
106
  end
107
107
 
108
+ def default_account_status
109
+ "pending"
110
+ end
111
+
108
112
  event :activate_by_token, :validate, on: :update,
109
113
  when: proc { |c| c.has_token? } do
110
114
  abort :failure, "no field manipulation mid-activation" if subcards.present?
@@ -91,18 +91,18 @@ RSpec.describe Card::Set::All::Account do
91
91
  let(:account) {card.account}
92
92
 
93
93
  it "handles email updates" do
94
- card.update_attributes! "+*account" => { "+*email" => "joe@user.co.uk" }
94
+ card.update! "+*account" => { "+*email" => "joe@user.co.uk" }
95
95
  expect(account.email).to eq("joe@user.co.uk")
96
96
  end
97
97
 
98
98
  it "lets Wagn Bot block accounts", as_bot: true do
99
- card.account.status_card.update_attributes! content: "blocked"
99
+ card.account.status_card.update! content: "blocked"
100
100
  expect(account.blocked?).to be_truthy
101
101
  end
102
102
 
103
103
  it "does not allow a user to block or unblock himself" do
104
104
  expect do
105
- account.status_card.update_attributes! content: "blocked"
105
+ account.status_card.update! content: "blocked"
106
106
  end.to raise_error(ActiveRecord::RecordInvalid,
107
107
  "Validation failed: Permission denied You don't have "\
108
108
  "permission to change the status of your own account")
@@ -2,17 +2,21 @@
2
2
 
3
3
  RSpec.describe Card::Set::Right::Account do
4
4
  describe "#create" do
5
+ let(:dummy_account_args) do
6
+ {
7
+ name: "TmpUser",
8
+ "+*account" => {
9
+ "+*email" => "tmpuser@wagn.org",
10
+ "+*password" => "tmp_pass"
11
+ }
12
+ }
13
+ end
14
+
5
15
  context "valid user" do
6
16
  # note - much of this is tested in account_request_spec
7
17
  before do
8
18
  Card::Auth.as_bot do
9
- @user_card = Card.create!(
10
- name: "TmpUser",
11
- type_id: Card::UserID,
12
- "+*account" => {
13
- "+*email" => "tmpuser@wagn.org", "+*password" => "tmp_pass"
14
- }
15
- )
19
+ @user_card = Card.create! dummy_account_args.merge(type_id: Card::UserID)
16
20
  end
17
21
  end
18
22
 
@@ -23,15 +27,18 @@ RSpec.describe Card::Set::Right::Account do
23
27
  end
24
28
 
25
29
  it "checks accountability of 'accounted' card" do
26
- @unaccountable = Card.create(
27
- name: "BasicUnaccountable",
28
- "+*account" => {
29
- "+*email" => "tmpuser@wagn.org",
30
- "+*password" => "tmp_pass"
31
- }
32
- )
33
- error_msg = @unaccountable.errors["+*account"].first
34
- expect(error_msg).to eq("not allowed on this card")
30
+ unaccountable = Card.create(dummy_account_args)
31
+ expect(unaccountable.errors["+*account"].first).to eq("not allowed on this card")
32
+ end
33
+
34
+ it "works for any accountable card -- not just User type" do
35
+ Card::Auth.as_bot do
36
+ rule_name = Card::Name[%i[basic type accountable]]
37
+ Card.create! name: rule_name, content: "1"
38
+ end
39
+
40
+ accountable = Card.create(dummy_account_args)
41
+ expect(accountable.errors).to be_empty
35
42
  end
36
43
 
37
44
  it "requires email" do
@@ -107,19 +114,19 @@ RSpec.describe Card::Set::Right::Account do
107
114
  end
108
115
  end
109
116
 
110
- describe "#update_attributes" do
117
+ describe "#update" do
111
118
  before do
112
119
  @account = Card::Auth.find_account_by_email("joe@user.com")
113
120
  end
114
121
 
115
122
  it "resets password" do
116
- @account.password_card.update_attributes!(content: "new password")
123
+ @account.password_card.update!(content: "new password")
117
124
  authenticated = Card::Auth.authenticate "joe@user.com", "new password"
118
125
  assert_equal @account, authenticated
119
126
  end
120
127
 
121
128
  it "does not rehash password when updating email" do
122
- @account.email_card.update_attributes! content: "joe2@user.com"
129
+ @account.email_card.update! content: "joe2@user.com"
123
130
  authenticated = Card::Auth.authenticate "joe2@user.com", "joe_pass"
124
131
  assert_equal @account, authenticated
125
132
  end
@@ -135,7 +142,7 @@ RSpec.describe Card::Set::Right::Account do
135
142
  Card::Auth.current_id = Card::AnonymousID
136
143
  end
137
144
 
138
- let(:trigger_reset) { @account.update_attributes! trigger: :reset_password }
145
+ let(:trigger_reset) { @account.update! trigger: :reset_password }
139
146
 
140
147
  it "authenticates with correct token" do
141
148
  expect(Card::Auth.current_id).to eq(Card::AnonymousID)
@@ -33,19 +33,19 @@ describe Card::Set::Right::Email do
33
33
 
34
34
  it "downcases email" do
35
35
  Card::Auth.as_bot do
36
- @email_card.update_attributes! content: "QuIrE@example.com"
36
+ @email_card.update! content: "QuIrE@example.com"
37
37
  expect(@email_card.db_content).to eq("quire@example.com")
38
38
  end
39
39
  end
40
40
 
41
41
  it "requires valid email" do
42
- @email_card.update_attributes content: "boop"
42
+ @email_card.update content: "boop"
43
43
  expect(@email_card.errors[:content].first)
44
44
  .to match(/must be valid address/)
45
45
  end
46
46
 
47
47
  it "requires unique email" do
48
- @email_card.update_attributes content: "joe@user.com"
48
+ @email_card.update content: "joe@user.com"
49
49
  expect(@email_card.errors[:content].first).to match(/must be unique/)
50
50
  end
51
51
  end
@@ -5,9 +5,9 @@ describe Card::Set::Right::Password do
5
5
  @account = Card::Auth.find_account_by_email("joe@user.com")
6
6
  end
7
7
 
8
- describe "#update_attributes" do
8
+ describe "#update" do
9
9
  it "encrypts password" do
10
- @account.password_card.update_attributes! content: "new password"
10
+ @account.password_card.update! content: "new password"
11
11
  expect(@account.password).not_to eq("new password")
12
12
  authenticated = Card::Auth.authenticate "joe@user.com", "new password"
13
13
  assert_equal @account, authenticated
@@ -15,7 +15,7 @@ describe Card::Set::Right::Password do
15
15
 
16
16
  it "validates password" do
17
17
  password_card = @account.password_card
18
- password_card.update_attributes content: "2b"
18
+ password_card.update content: "2b"
19
19
  expect(password_card.errors[:password]).not_to be_empty
20
20
  end
21
21
 
@@ -31,8 +31,7 @@ describe Card::Set::Right::Password do
31
31
  end
32
32
 
33
33
  it "does not break email editing" do
34
- @account.update_attributes! subcards: { "+*password" => "",
35
- "+*email" => "joe2@user.com" }
34
+ @account.update! subcards: { "+*password" => "", "+*email" => "joe2@user.com" }
36
35
  expect(@account.email).to eq("joe2@user.com")
37
36
  expect(@account.password).not_to be_empty
38
37
  end
@@ -32,20 +32,20 @@ RSpec.describe Card::Set::Self::Signin do
32
32
 
33
33
  context "#update" do
34
34
  it "triggers signin with valid credentials" do
35
- @card.update_attributes! "+*email" => "joe@admin.com",
36
- "+*password" => "joe_pass"
35
+ @card.update! "+*email" => "joe@admin.com",
36
+ "+*password" => "joe_pass"
37
37
  expect(Card::Auth.current).to eq(Card["joe admin"])
38
38
  end
39
39
 
40
40
  it "does not trigger signin with bad email" do
41
- @card.update_attributes! "+*email" => "schmoe@admin.com",
42
- "+*password" => "joe_pass"
41
+ @card.update! "+*email" => "schmoe@admin.com",
42
+ "+*password" => "joe_pass"
43
43
  expect(@card.errors[:signin].first).to match(/Unrecognized email/)
44
44
  end
45
45
 
46
46
  it "does not trigger signin with bad password" do
47
- @card.update_attributes! "+*email" => "joe@admin.com",
48
- "+*password" => "joe_fail"
47
+ @card.update! "+*email" => "joe@admin.com",
48
+ "+*password" => "joe_fail"
49
49
  expect(@card.errors[:signin].first).to match(/Wrong password/)
50
50
  end
51
51
  end
@@ -53,13 +53,12 @@ RSpec.describe Card::Set::Self::Signin do
53
53
  context "#reset password" do
54
54
  it "is triggered by an update" do
55
55
  # Card['joe admin'].account.token.should be_nil FIXME: this should be t
56
- @card.update_attributes! "+*email" => "joe@admin.com"
56
+ @card.update! "+*email" => "joe@admin.com"
57
57
  expect(Card["joe admin"].account.token).not_to be_nil
58
58
  end
59
59
 
60
60
  it "returns an error if email is not found" do
61
- @card.update_attributes! "+*email" => "schmoe@admin.com",
62
- trigger: :send_reset_password_token
61
+ @card.update! "+*email" => "schmoe@admin.com", trigger: :send_reset_password_token
63
62
  expect(@card.errors[:email].first).to match(/not recognized/)
64
63
  end
65
64
  end
@@ -82,7 +82,7 @@ describe Card::Set::Type::Signup do
82
82
  it "is activated by an update" do
83
83
  Card::Env.params[:token] = @token
84
84
  @signup = Card.fetch "big bad wolf"
85
- @signup.update_attributes({})
85
+ @signup.update({})
86
86
  # puts @signup.errors.full_messages * "\n"
87
87
  expect(@signup.errors).to be_empty
88
88
  expect(@signup.type_id).to eq(Card::UserID)
@@ -96,7 +96,7 @@ describe Card::Set::Type::Signup do
96
96
  @account.token_card.expire
97
97
  Card::Env.params[:token] = @token
98
98
  @signup = Card.fetch "big bad wolf"
99
- result = @signup.update_attributes!({})
99
+ result = @signup.update!({})
100
100
  # successfully completes save
101
101
  expect(result).to eq(true)
102
102
  @account.reload
@@ -176,7 +176,7 @@ describe Card::Set::Type::Signup do
176
176
  context "a welcome email card exists" do
177
177
  before do
178
178
  Card::Auth.as_bot do
179
- Card[:welcome_email].update_attributes!(
179
+ Card[:welcome_email].update!(
180
180
  subcards: { "+*subject" => "welcome",
181
181
  "+*html_message" => "Welcome {{_self|name}}" }
182
182
  )
@@ -14,7 +14,7 @@ describe Card::Set::Self::Admin do
14
14
  def run_admin_task task
15
15
  Card::Auth.as_bot do
16
16
  Card::Env.params[:task] = task
17
- admin.update_attributes({})
17
+ admin.update({})
18
18
  end
19
19
  end
20
20
 
@@ -46,8 +46,8 @@ describe Card::Set::Self::Admin do
46
46
  it "triggers deleting old revisions (with right params)" do
47
47
  Card::Auth.as_bot do
48
48
  a = Card["A"]
49
- a.update_attributes! content: "a new day"
50
- a.update_attributes! content: "another day"
49
+ a.update! content: "a new day"
50
+ a.update! content: "another day"
51
51
  expect(a.actions.count).to eq(3)
52
52
  run_admin_task :clear_history
53
53
  expect(a.actions.count).to eq(1)
@@ -61,7 +61,7 @@ describe Card::Set::Self::Admin do
61
61
  # puts a.references_out.count
62
62
  # Card::Env.params[:task] = :repair_references
63
63
  # puts a.references_out.count
64
- # @all.update_attributes({})
64
+ # @all.update({})
65
65
  # puts a.references_out.count
66
66
  #
67
67
  # end