spec/spec_helper.rb in syslogger-1.6.5 vs spec/spec_helper.rb in syslogger-1.6.6
- old
+ new
@@ -1,7 +1,8 @@
require 'simplecov'
require 'rspec'
+require 'active_job'
# Start Simplecov
SimpleCov.start
# Configure RSpec
@@ -14,8 +15,39 @@
config.expect_with :rspec do |c|
c.syntax = :expect
end
end
+
+# Module helper for unit tests
+module JobBuffer
+ class << self
+ def clear
+ values.clear
+ end
+
+ def add(value)
+ values << value
+ end
+
+ def values
+ @values ||= []
+ end
+
+ def last_value
+ values.last
+ end
+ end
+end
+
+# Class helper for unit tests
+class HelloJob < ActiveJob::Base
+ def perform(greeter = "David")
+ JobBuffer.add("#{greeter} says hello")
+ end
+end
+
+# Configure I18n otherwise it throws errors in syslog
+I18n.available_locales = [:en]
# Load lib
require 'syslogger'