card 1.96.7 → 1.96.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/db/migrate_core_cards/20120611203506_rails_inflection_updates.rb +2 -2
- data/db/migrate_core_cards/20130823192433_add_style_cards.rb +5 -5
- data/db/migrate_core_cards/20130910183318_move_styles_to_content.rb +1 -1
- data/db/migrate_core_cards/20130920291703_update_stylesheets.rb +1 -1
- data/db/migrate_core_cards/20131016172445_common_css_patch.rb +1 -1
- data/db/migrate_core_cards/20140110193325_reset_account_request_type.rb +1 -1
- data/db/migrate_core_cards/20140307231621_user_data_to_cards.rb +1 -1
- data/db/migrate_core_cards/20140512155840_add_script_cards.rb +1 -1
- data/db/migrate_core_cards/20140629222005_add_email_cards.rb +2 -2
- data/db/migrate_core_cards/20141120120605_fix_notification_html_message.rb +1 -1
- data/db/migrate_core_cards/20141204061304_watchers_to_following.rb +1 -1
- data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +4 -4
- data/db/migrate_core_cards/20150317162412_bootstrap_themes.rb +1 -1
- data/db/migrate_core_cards/20150326205655_bootswatch_themes.rb +3 -3
- data/db/migrate_core_cards/20150331135745_new_card_menu.rb +1 -1
- data/db/migrate_core_cards/20150501010515_responsive_sidebar.rb +1 -1
- data/db/migrate_core_cards/20150510031118_fix_skin_codenames.rb +1 -1
- data/db/migrate_core_cards/20150610180019_add_recaptcha_key_and_admin_info_cards.rb +1 -1
- data/db/migrate_core_cards/20150627205133_fix_script_bootstrap_card_type.rb +1 -1
- data/db/migrate_core_cards/20150702130543_remove_edit_toolbar_pinned.rb +1 -1
- data/db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb +2 -2
- data/db/migrate_core_cards/20150824135418_update_file_history.rb +1 -1
- data/db/migrate_core_cards/20150910085603_remove_performance_log_card.rb +1 -1
- data/db/migrate_core_cards/20160801143221_change_bootstrap_card_type_to_scss.rb +1 -1
- data/db/migrate_core_cards/20160811115836_rename_stats_to_admin.rb +1 -1
- data/db/migrate_core_cards/20170830210517_correct_signup_success_message.rb +1 -1
- data/db/migrate_core_cards/data/1.12_stylesheets/traditional.scss +0 -9
- data/db/seed/test/seed.rb +3 -3
- data/lib/card/act_manager.rb +1 -1
- data/lib/card/cache.rb +5 -1
- data/lib/card/codename.rb +1 -1
- data/lib/card/model/save_helper.rb +3 -4
- data/lib/card/query.rb +15 -9
- data/lib/card/query/abstract_query/tie.rb +1 -0
- data/lib/card/query/card_query/interpretation.rb +1 -1
- data/lib/card/query/card_query/match_attributes.rb +2 -2
- data/lib/card/query/card_query/normalization.rb +6 -3
- data/lib/card/query/value.rb +3 -2
- data/lib/card/set/event/delayed_event.rb +1 -0
- data/mod/account/set/right/account.rb +4 -12
- data/mod/account/set/type/signup.rb +4 -0
- data/mod/account/spec/set/all/account_spec.rb +3 -3
- data/mod/account/spec/set/right/account_spec.rb +27 -20
- data/mod/account/spec/set/right/email_spec.rb +3 -3
- data/mod/account/spec/set/right/password_spec.rb +4 -5
- data/mod/account/spec/set/self/signin_spec.rb +8 -9
- data/mod/account/spec/set/type/signup_spec.rb +3 -3
- data/mod/admin/spec/set/self/admin_spec.rb +4 -4
- data/mod/bootstrap/db/migrate_core_cards/20180423160231_migrate_customized_bootstrap_skin.rb +2 -2
- data/mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb +1 -1
- data/mod/bootstrap/db/migrate_core_cards/20180601133753_migrate_skins.rb +1 -1
- data/mod/bootstrap/db/migrate_core_cards/data/20181108181219_migrate_classic_skins_to_bootstrap.rb +2 -2
- data/mod/bootstrap/lib/stylesheets/style_bootstrap_cards.scss +3 -0
- data/mod/bootstrap/set/abstract/bootswatch_theme.rb +1 -1
- data/mod/bootstrap/spec/set/type/bootswatch_skin_spec.rb +1 -1
- data/mod/bootstrap/spec/set/type/customized_bootswatch_skin_spec.rb +1 -1
- data/mod/carrierwave/lib/carrier_wave/file_card_uploader.rb +2 -2
- data/mod/carrierwave/set/abstract/attachment.rb +1 -1
- data/mod/carrierwave/set/abstract/attachment/storage_type.rb +2 -2
- data/mod/carrierwave/set/abstract/attachment/upload_cache.rb +2 -2
- data/mod/carrierwave/spec/set/type/file_spec.rb +9 -12
- data/mod/carrierwave/spec/set/type/image_spec.rb +2 -2
- data/mod/core/set/all/actify.rb +5 -2
- data/mod/core/set/all/cache.rb +1 -1
- data/mod/core/set/all/content.rb +12 -30
- data/mod/core/set/all/contextual_content.rb +28 -0
- data/mod/core/set/all/name.rb +1 -1
- data/mod/core/set/all/rules.rb +1 -0
- data/mod/core/set/all/trash.rb +2 -2
- data/mod/core/set/all/utils.rb +2 -2
- data/mod/core/spec/set/all/actify_spec.rb +45 -2
- data/mod/core/spec/set/all/codename_spec.rb +2 -2
- data/mod/core/spec/set/all/event_conditions_spec.rb +15 -16
- data/mod/core/spec/set/all/name_events_spec.rb +2 -2
- data/mod/core/spec/set/all/observer_spec.rb +1 -1
- data/mod/core/spec/set/all/permissions_spec.rb +3 -3
- data/mod/core/spec/set/all/references_spec.rb +1 -1
- data/mod/core/spec/set/all/rename_spec.rb +2 -2
- data/mod/core/spec/set/all/trash_spec.rb +1 -1
- data/mod/follow/set/all/follow/follow_link.rb +7 -1
- data/mod/follow/spec/set/all/notify_spec.rb +2 -2
- data/mod/follow/spec/set/right/account_spec.rb +2 -2
- data/mod/follow/spec/set/right/followers_spec.rb +2 -2
- data/mod/follow/spec/set/self/follow_defaults_spec.rb +1 -1
- data/mod/follow/spec/set/type/notification_template_spec.rb +1 -1
- data/mod/history/set/all/history.rb +1 -1
- data/mod/history/set/all/history/act_listing.rb +2 -1
- data/mod/history/set/all/history/events.rb +3 -3
- data/mod/machines/lib/stylesheets/style_cards.scss +17 -16
- data/mod/machines/set/abstract/machine.rb +3 -2
- data/mod/machines/set/abstract/machine/output_cache.rb +1 -1
- data/mod/machines/set/abstract/machine_input.rb +1 -1
- data/mod/machines/spec/set/right/machine_cache_spec.rb +2 -2
- data/mod/machines/spec/set/type/skin_spec.rb +2 -2
- data/mod/pointer/spec/set/abstract/pointer/events_spec.rb +2 -2
- data/mod/search/set/abstract/01_filter_form_helper.rb +5 -1
- data/mod/search/set/abstract/search/views.rb +1 -1
- data/mod/settings/spec/set/right/comment_spec.rb +1 -1
- data/mod/solid_cache/set/right/solid_cache.rb +1 -1
- data/mod/solid_cache/spec/set/abstract/solid_cache_spec.rb +4 -4
- data/mod/standard/set/self/activity_toolbar_button.rb +1 -1
- data/mod/standard/spec/content/chunk/include_spec.rb +1 -1
- data/mod/standard/spec/set/all/history_spec.rb +5 -5
- data/mod/standard/spec/set/type/email_template/email_config_spec.rb +2 -2
- data/mod/standard/spec/set/type/list_spec.rb +9 -9
- data/mod/standard/spec/set/type/listed_by_spec.rb +9 -9
- data/mod/standard/spec/set/type/search_type_spec.rb +2 -3
- data/mod/virtual/lib/card/virtual.rb +1 -1
- data/mod/virtual/set/abstract/virtual_cache.rb +2 -2
- metadata +5 -4
data/lib/card/query.rb
CHANGED
@@ -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
|
-
|
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: %
|
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: %
|
60
|
-
conjunction: %
|
61
|
-
ignore: %
|
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
|
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 = %
|
69
|
-
.each_with_object({}) { |v, h| h[v
|
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(
|
@@ -49,9 +49,9 @@ class Card
|
|
49
49
|
end
|
50
50
|
|
51
51
|
# TODO: move sql to SqlStatement
|
52
|
-
def key_like pattern,
|
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"
|
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
|
-
|
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,
|
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
|
33
|
+
else raise Error::BadQuery, "Invalid value type: #{val.class} (#{val.inspect})"
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
data/lib/card/query/value.rb
CHANGED
@@ -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
|
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
|
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 =
|
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.
|
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.
|
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
|
-
|
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.
|
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.
|
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.
|
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
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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 "#
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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 "#
|
8
|
+
describe "#update" do
|
9
9
|
it "encrypts password" do
|
10
|
-
@account.password_card.
|
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.
|
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.
|
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.
|
36
|
-
|
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.
|
42
|
-
|
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.
|
48
|
-
|
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.
|
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.
|
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.
|
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.
|
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].
|
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.
|
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.
|
50
|
-
a.
|
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.
|
64
|
+
# @all.update({})
|
65
65
|
# puts a.references_out.count
|
66
66
|
#
|
67
67
|
# end
|