1
- require ' test_helper'
1
+ require " test_helper"
2
2
3
3
# Test Models:
4
4
#
@@ -35,29 +35,29 @@ class ActsAsSequencedTest < ActiveSupport::TestCase
35
35
36
36
test "lambda start_at" do
37
37
account = Account . create
38
- product = Product . create ( : account_id => account . id )
38
+ product = Product . create ( account_id : account . id )
39
39
assert_equal 3 , product . sequential_id
40
40
41
- another_product = Product . create ( : account_id => account . id )
41
+ another_product = Product . create ( account_id : account . id )
42
42
assert_equal 4 , another_product . sequential_id
43
43
end
44
44
45
45
test "custom start_at with populated table" do
46
46
account = Account . create
47
- account . invoices . create ( : sequential_id => 1 )
47
+ account . invoices . create ( sequential_id : 1 )
48
48
invoice = account . invoices . create
49
49
assert_equal 1000 , invoice . sequential_id
50
50
end
51
51
52
52
test "sequential id increment" do
53
53
question = Question . create
54
- question . answers . create ( : sequential_id => 10 )
54
+ question . answers . create ( sequential_id : 10 )
55
55
another_answer = question . answers . create
56
56
assert_equal 11 , another_answer . sequential_id
57
57
end
58
58
59
59
test "default scope" do
60
- Subscription . create ( : sequential_id => 1 )
60
+ Subscription . create ( sequential_id : 1 )
61
61
subscription = Subscription . create
62
62
assert_equal 2 , subscription . sequential_id
63
63
end
@@ -93,8 +93,8 @@ class ActsAsSequencedTest < ActiveSupport::TestCase
93
93
94
94
test "manually setting sequential id" do
95
95
question = Question . create
96
- answer = question . answers . build ( : sequential_id => 10 )
97
- another_answer = question . answers . build ( : sequential_id => 10 )
96
+ answer = question . answers . build ( sequential_id : 10 )
97
+ another_answer = question . answers . build ( sequential_id : 10 )
98
98
answer . save
99
99
another_answer . save
100
100
@@ -104,23 +104,23 @@ class ActsAsSequencedTest < ActiveSupport::TestCase
104
104
105
105
test "model with a default scope for sorting" do
106
106
question = Question . create
107
- ( 1 ..3 ) . each { |id | question . comments . create ( : sequential_id => id ) }
107
+ ( 1 ..3 ) . each { |id | question . comments . create ( sequential_id : id ) }
108
108
comment = question . comments . create
109
109
assert_equal 4 , comment . sequential_id
110
110
end
111
111
112
112
test "multi-column scopes" do
113
- Email . create ( : emailable_id => 1 , : emailable_type => "User" , : sequential_id => 2 )
114
- Email . create ( : emailable_id => 1 , : emailable_type => "Question" , : sequential_id => 3 )
115
- email = Email . create ( : emailable_id => 1 , : emailable_type => "User" )
113
+ Email . create ( emailable_id : 1 , emailable_type : "User" , sequential_id : 2 )
114
+ Email . create ( emailable_id : 1 , emailable_type : "Question" , sequential_id : 3 )
115
+ email = Email . create ( emailable_id : 1 , emailable_type : "User" )
116
116
assert_equal 3 , email . sequential_id
117
117
end
118
118
119
119
test "skip option" do
120
- rating = Rating . create ( : comment_id => 1 , : score => 1 )
120
+ rating = Rating . create ( comment_id : 1 , score : 1 )
121
121
assert_equal 1 , rating . sequential_id
122
122
123
- rating = Rating . create ( : comment_id => 1 , : score => 0 )
123
+ rating = Rating . create ( comment_id : 1 , score : 0 )
124
124
assert_nil rating . sequential_id
125
125
end
126
126
0 commit comments