spec/localeapp/rails/controller_spec.rb in localeapp-0.9.3 vs spec/localeapp/rails/controller_spec.rb in localeapp-1.0.0

- old
+ new

@@ -17,11 +17,11 @@ :api_key => "my_key" } with_configuration(configuration) do @controller = TestController.new end - now = Time.now; Time.stub(:now).and_return(now) + now = Time.now; allow(Time).to receive(:now).and_return(now) end after do LocaleappSynchronizationData::destroy end @@ -31,16 +31,16 @@ Localeapp.configuration.environment_name = 'development' end it "calls poller.poll! when the synchronization file's polled_at has changed" do Localeapp.poller.write_synchronization_data!(01234, 56789) - Localeapp.poller.should_receive(:poll!) + expect(Localeapp.poller).to receive(:poll!) @controller.handle_translation_updates end it "doesn't call poller.poll! when the synchronization file's polled_at is the same" do - Localeapp.poller.should_not_receive(:poll!) + expect(Localeapp.poller).not_to receive(:poll!) @controller.handle_translation_updates end end context "when polling is disabled" do @@ -48,34 +48,34 @@ Localeapp.configuration.environment_name = 'production' end it "doesn't poller.poll! when the synchronization file's polled_at has changed" do Localeapp.poller.write_synchronization_data!(01234, 56789) - Localeapp.poller.should_not_receive(:poll!) + expect(Localeapp.poller).not_to receive(:poll!) @controller.handle_translation_updates end it "doesn't poller.poll! when the synchronization file's polled_at is the same" do - Localeapp.poller.should_not_receive(:poll!) + expect(Localeapp.poller).not_to receive(:poll!) @controller.handle_translation_updates end end context "when reloading is enabled" do before do Localeapp.configuration.environment_name = 'development' - Localeapp.poller.stub(:poll!) + allow(Localeapp.poller).to receive(:poll!) end it "calls I18n.reload! when the synchronization file's updated_at has changed" do Localeapp.poller.write_synchronization_data!(01234, 56789) - I18n.should_receive(:reload!) + expect(I18n).to receive(:reload!) @controller.handle_translation_updates end it "doesn't call I18n.relaod! when the synchronization file's updated_at is the same" do - I18n.should_not_receive(:reload!) + expect(I18n).not_to receive(:reload!) @controller.handle_translation_updates end end context "when reloading is disabled" do @@ -83,16 +83,16 @@ Localeapp.configuration.environment_name = 'production' end it "doesn't call I18n.reload! when the synchronization file's updated_at has changed" do Localeapp.poller.write_synchronization_data!(01234, 56789) - I18n.should_not_receive(:reload!) + expect(I18n).not_to receive(:reload!) @controller.handle_translation_updates end it "doesn't call I18n.relaod! when the synchronization file's updated_at is the same" do - I18n.should_not_receive(:reload!) + expect(I18n).not_to receive(:reload!) @controller.handle_translation_updates end end context "when an api_key is missing" do @@ -125,21 +125,21 @@ @controller = TestController.new end it "does nothing when sending is disabled" do Localeapp.configuration.environment_name = 'test' - Localeapp.sender.should_not_receive(:post_missing_translations) + expect(Localeapp.sender).not_to receive(:post_missing_translations) @controller.send_missing_translations end it "proceeds when configuration is enabled" do Localeapp.configuration.environment_name = 'development' - Localeapp.sender.should_receive(:post_missing_translations) + expect(Localeapp.sender).to receive(:post_missing_translations) @controller.send_missing_translations end it "rejects blacklisted translations" do Localeapp.configuration.environment_name = 'development' - Localeapp.missing_translations.should_receive(:reject_blacklisted) + expect(Localeapp.missing_translations).to receive(:reject_blacklisted) @controller.send_missing_translations end end