|
105 | 105 | Kernel.srand config.seed |
106 | 106 | end |
107 | 107 |
|
108 | | -RSpec.shared_examples 'enqueue_actor' do |job_method, time_zone_name=nil| |
| 108 | +RSpec.shared_examples 'enqueue_actor' do |job_method, time_zone_name=nil, locale=nil| |
109 | 109 | subject do |
110 | 110 | Time.use_zone(time_zone_name) do |
111 | | - described_class.enqueue_actor(args) |
| 111 | + I18n.with_locale(locale) do |
| 112 | + described_class.enqueue_actor(args) |
| 113 | + end |
112 | 114 | end |
113 | 115 | end |
114 | 116 |
|
|
121 | 123 | server_revision: server_revision, |
122 | 124 | }.tap do |args| |
123 | 125 | args[:time_zone_name] = time_zone_name if time_zone_name |
| 126 | + args[:locale] = locale.to_s if locale |
124 | 127 | end, |
125 | 128 | ) |
126 | 129 |
|
127 | 130 | subject |
128 | 131 | end |
129 | 132 | end |
130 | 133 |
|
131 | | -RSpec.shared_examples 'perform' do |job_method, time_zone_name=nil| |
| 134 | +RSpec.shared_examples 'perform' do |job_method, time_zone_name=nil, locale=nil| |
132 | 135 | let(:execution_time) { Time.now } |
133 | 136 |
|
134 | 137 | subject do |
135 | 138 | Time.use_zone(time_zone_name) do |
136 | | - # do not allow to actually enqueue job |
137 | | - expect(described_class).to receive(job_method) |
| 139 | + I18n.with_locale(locale) do |
| 140 | + # do not allow to actually enqueue job |
| 141 | + expect(described_class).to receive(job_method) |
138 | 142 |
|
139 | | - described_class.enqueue_actor(args) |
| 143 | + described_class.enqueue_actor(args) |
140 | 144 |
|
141 | | - perform_args = args.dup |
142 | | - perform_args[:time_zone_name] = time_zone_name if time_zone_name |
| 145 | + perform_args = args.dup |
| 146 | + perform_args[:time_zone_name] = time_zone_name if time_zone_name |
| 147 | + perform_args[:locale] = locale.to_s if locale |
143 | 148 |
|
144 | | - Timecop.travel(execution_time) do |
145 | | - described_class.new.perform(perform_args) |
| 149 | + Timecop.travel(execution_time) do |
| 150 | + described_class.new.perform(perform_args) |
| 151 | + end |
146 | 152 | end |
147 | 153 | end |
148 | 154 | end |
149 | 155 |
|
150 | 156 | it 'performs actor' do |
151 | 157 | Time.use_zone(time_zone_name) do |
152 | | - expect(subject).to eq(serialized_value: ParallelWorkforce.configuration.serializer.serialize(value)) |
| 158 | + I18n.with_locale(locale) do |
| 159 | + expect(subject).to eq(serialized_value: ParallelWorkforce.configuration.serializer.serialize(value)) |
| 160 | + end |
153 | 161 | end |
154 | 162 | end |
155 | 163 |
|
|
0 commit comments