|
3 | 3 | class PlayerTest < Minitest::Test |
4 | 4 | def test_created_at_setter_parses_integers |
5 | 5 | time = 1415914655 |
6 | | - player = OneSignal::Player.new |
7 | 6 |
|
8 | | - player.created_at = time |
| 7 | + player = OneSignal::Player.new(created_at: time) |
9 | 8 |
|
10 | 9 | assert_equal Time.at(time), player.created_at |
11 | 10 | end |
12 | 11 |
|
13 | 12 | def test_created_at_setter_leaves_times_alone |
14 | 13 | time = Time.now |
15 | | - player = OneSignal::Player.new |
16 | 14 |
|
17 | | - player.created_at = time |
| 15 | + player = OneSignal::Player.new(created_at: time) |
18 | 16 |
|
19 | 17 | assert_equal time, player.created_at |
20 | 18 | end |
21 | 19 |
|
22 | 20 | def test_device_type_setter_parses_integers |
23 | | - player = OneSignal::Player.new |
24 | | - |
25 | | - player.device_type = 0 |
| 21 | + player = OneSignal::Player.new(device_type: 0) |
26 | 22 |
|
27 | 23 | assert_equal 'ios', player.device_type |
28 | 24 | end |
29 | 25 |
|
30 | 26 | def test_device_type_setter_leaves_times_alone |
31 | 27 | type = 'ios' |
32 | | - player = OneSignal::Player.new |
33 | 28 |
|
34 | | - player.device_type = type |
| 29 | + player = OneSignal::Player.new(device_type: type) |
35 | 30 |
|
36 | 31 | assert_equal type, player.device_type |
37 | 32 | end |
38 | 33 |
|
39 | 34 | def test_last_active_setter_parses_integers |
40 | 35 | time = 1415914655 |
41 | | - player = OneSignal::Player.new |
42 | 36 |
|
43 | | - player.last_active = time |
| 37 | + player = OneSignal::Player.new(last_active: time) |
44 | 38 |
|
45 | 39 | assert_equal Time.at(time), player.last_active |
46 | 40 | end |
47 | 41 |
|
48 | 42 | def test_last_active_setter_leaves_times_alone |
49 | 43 | time = Time.now |
50 | | - player = OneSignal::Player.new |
51 | 44 |
|
52 | | - player.last_active = time |
| 45 | + player = OneSignal::Player.new(last_active: time) |
53 | 46 |
|
54 | 47 | assert_equal time, player.last_active |
55 | 48 | end |
|
0 commit comments