Make some specs pass
This commit is contained in:
@@ -11,7 +11,7 @@ end
|
||||
|
||||
gemspec
|
||||
|
||||
gem "rails", "~> 5.1"
|
||||
gem "rails", "~> 8.0"
|
||||
|
||||
group :development, :test do
|
||||
gem 'bootsnap', require: false
|
||||
@@ -28,6 +28,7 @@ group :development, :test do
|
||||
gem 'puma'
|
||||
gem 'paperclip', '~> 5.3'
|
||||
gem 'dunlop-ember', gitlab: 'benja-2/dunlop-ember', branch: 'master'
|
||||
gem 'record_collection' #, github: 'bterkuile/record_collection', branch: 'master'
|
||||
|
||||
#gem 'carrierwave'
|
||||
#gem 'fog-aws'
|
||||
|
||||
@@ -6,7 +6,7 @@ module Dunlop::Loggable
|
||||
end
|
||||
|
||||
def with_nested_logger_and_catch_failed(scope=nil, options={})
|
||||
scope ||= caller[0][/`.*'/][1..-2]
|
||||
scope ||= caller[0][/'.*'/][1..-2]
|
||||
options[:exception_notifier] = true unless options.has_key?(:exception_notifier)
|
||||
backtrace = nil
|
||||
::Dunlop::NestedLogger.scope('empty sandbox', benchmark: false) do
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
module Dunlop::OverdueHandling
|
||||
module Dunlop
|
||||
module OverdueHandling
|
||||
@registry = {}
|
||||
@final_states = %w[overdue completed rejected]
|
||||
|
||||
@@ -122,3 +123,4 @@ module Dunlop::OverdueHandling
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
||||
ENGINE_PATH = File.expand_path('../../lib/dunlop/engine', __FILE__)
|
||||
APP_PATH = File.expand_path("../spec/dummy/config/application", __dir__)
|
||||
|
||||
# Set up gems listed in the Gemfile.
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
|
||||
+2
-1
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
||||
|
||||
s.add_dependency "rails", ">= 4.2.6"
|
||||
s.add_dependency 'slim-rails'
|
||||
#s.add_dependency 'record_collection', '>= 0.10.4'
|
||||
#s.add_dependency 'record_collection', '>= 0.10.4' # Only in Gemfile to make not requried
|
||||
s.add_dependency 'request_store'
|
||||
s.add_dependency 'ransack'
|
||||
s.add_dependency 'responders'
|
||||
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
|
||||
s.add_dependency 'facets'
|
||||
s.add_dependency 'memoist'
|
||||
s.add_dependency 'cancancan'
|
||||
s.add_dependency 'csv'
|
||||
|
||||
# assets
|
||||
#s.add_dependency 'momentjs-rails'
|
||||
|
||||
@@ -36,8 +36,8 @@ class Dunlop::Install::BaseGenerator < Rails::Generators::Base
|
||||
config.application_name = "#{Rails.application.class.name.deconstantize}"
|
||||
|
||||
config.git_version = Rails.env
|
||||
config.git_version = File.read('REVISION').strip if File.exists?('REVISION')
|
||||
config.git_version = File.read('OFFLINE_REVISION').strip if File.exists?('OFFLINE_REVISION')
|
||||
config.git_version = File.read('REVISION').strip if File.exist?('REVISION')
|
||||
config.git_version = File.read('OFFLINE_REVISION').strip if File.exist?('OFFLINE_REVISION')
|
||||
|
||||
RUBY
|
||||
end
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
//= link_tree ../images
|
||||
//= link_directory ../javascripts .js
|
||||
//= link_directory ../stylesheets .css
|
||||
@@ -1,8 +1,8 @@
|
||||
class OwnerInitialization < ApplicationRecord
|
||||
include WorkflowStepModel
|
||||
|
||||
serialize :window_from, DayTimeMinutes
|
||||
serialize :window_to, DayTimeMinutes
|
||||
serialize :window_from, coder: DayTimeMinutes
|
||||
serialize :window_to, coder: DayTimeMinutes
|
||||
|
||||
activate_dunlop!
|
||||
end
|
||||
|
||||
@@ -22,8 +22,8 @@ module Dummy
|
||||
config.application_name = 'Dunlop'
|
||||
|
||||
config.git_version = nil
|
||||
config.git_version = File.read('REVISION').strip if File.exists?('REVISION')
|
||||
config.git_version = File.read('OFFLINE_REVISION').strip if File.exists?('OFFLINE_REVISION')
|
||||
config.git_version = File.read('REVISION').strip if File.exist?('REVISION')
|
||||
config.git_version = File.read('OFFLINE_REVISION').strip if File.exist?('OFFLINE_REVISION')
|
||||
|
||||
config.file_storage_path = Rails.root.join('files') # source file storage
|
||||
config.working_path = '/tmp' # source file processing directory
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
Rails.application.config.after_initialize do
|
||||
Dunlop::OverdueHandling.define do
|
||||
when_workflow_step :contractor_initialization, is: 2.days, from: {owner_initialization: :plan_date}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
Rails.application.config.after_initialize do
|
||||
Dunlop::Workflow.configure do |config|
|
||||
config.max_number_of_records_in_display_badge = 72
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
Rails.application.config.after_initialize do
|
||||
Dunlop::WorkflowStepsInBatchFinished.define do
|
||||
the_final_states_are %w[rejected completed]
|
||||
|
||||
@@ -26,3 +27,4 @@ Dunlop::WorkflowStepsInBatchFinished.define do
|
||||
#end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ FactoryBot.define do
|
||||
original_file { Tempfile.new("target_file_factory") }
|
||||
trait :failed do
|
||||
after(:build) { |record| record.log_entries.build(body: 'ERROR - some reason to fail') }
|
||||
state 'failed'
|
||||
state { 'failed' }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@ FactoryBot.define do
|
||||
|
||||
factory :user do
|
||||
email
|
||||
password 'password'
|
||||
role_names %w[read-class-WorkflowInstance]
|
||||
password { 'password' }
|
||||
role_names { %w[read-class-WorkflowInstance] }
|
||||
end
|
||||
|
||||
factory :admin, class: User do
|
||||
email 'admin@example.com'
|
||||
password 'password'
|
||||
admin true
|
||||
email { 'admin@example.com' }
|
||||
password { 'password' }
|
||||
admin { true }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
FactoryBot.define do
|
||||
factory :workflow_instance do
|
||||
after(:build){|instance| instance.setup_workflow_steps }
|
||||
state "unplanned" # default for Vula
|
||||
state { "unplanned" } # default for Vula
|
||||
|
||||
trait :uncategorized do
|
||||
state 'uncategorized'
|
||||
state { 'uncategorized' }
|
||||
end
|
||||
|
||||
trait :unplanned do
|
||||
state 'unplanned'
|
||||
state { 'unplanned' }
|
||||
end
|
||||
|
||||
trait :planned do
|
||||
state 'planned'
|
||||
state { 'planned' }
|
||||
end
|
||||
|
||||
trait :active do
|
||||
state 'active'
|
||||
state { 'active' }
|
||||
after :build do |instance|
|
||||
instance.workflow_steps.first.state = 'processing'
|
||||
end
|
||||
end
|
||||
|
||||
trait :overdue do
|
||||
state 'overdue'
|
||||
state { 'overdue' }
|
||||
after :build do |instance|
|
||||
instance.owner_initialization.plan_date = 1.year.ago
|
||||
instance.contractor_initialization.state = 'overdue'
|
||||
@@ -31,14 +31,14 @@ FactoryBot.define do
|
||||
end
|
||||
|
||||
trait :all_completed do
|
||||
state 'all_completed'
|
||||
state { 'all_completed' }
|
||||
after :build do |instance|
|
||||
instance.workflow_steps.each{|workflow_step| workflow_step.state = 'completed' }
|
||||
end
|
||||
end
|
||||
|
||||
trait :any_rejected do
|
||||
state 'any_rejected'
|
||||
state { 'any_rejected' }
|
||||
after :build do |instance|
|
||||
instance.workflow_steps.first.state = 'rejected'
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe Dunlop::ExecutionBatch do
|
||||
describe ::ExecutionBatch do
|
||||
let(:time) { '1981-03-09T13:33:04Z'.to_time }
|
||||
let(:model) { ExecutionBatch::MyBatch }
|
||||
before { Timecop.freeze time }
|
||||
@@ -43,7 +43,7 @@ RSpec::Support::ObjectFormatter.default_instance.max_formatted_output_length = 1
|
||||
|
||||
RSpec.configure do |config|
|
||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||
config.fixture_path = Dunlop::Engine.root.join("spec/fixtures")
|
||||
config.fixture_paths = [Dunlop::Engine.root.join("spec/fixtures")]
|
||||
config.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
|
||||
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ RSpec.describe Dunlop::FileZip do
|
||||
context "mime-type: application/zip" do
|
||||
|
||||
it "unzips the file to the provided filename" do
|
||||
expect(File.exists?(destination_filename)).to be_falsey
|
||||
expect(File.exist?(destination_filename)).to be_falsey
|
||||
subject.unzip(zipped_filename, destination_filename)
|
||||
expect(File.exists?(destination_filename)).to be_truthy
|
||||
expect(File.exists?(zipped_filename)).to be_truthy
|
||||
expect(File.exist?(destination_filename)).to be_truthy
|
||||
expect(File.exist?(zipped_filename)).to be_truthy
|
||||
expect(File.read(destination_filename)).to eq File.read(unzipped_filename)
|
||||
end
|
||||
|
||||
@@ -34,10 +34,10 @@ RSpec.describe Dunlop::FileZip do
|
||||
context "mime-type: application/x-gzip" do
|
||||
|
||||
it "unzips the file to the provided filename" do
|
||||
expect(File.exists?(destination_filename)).to be_falsey
|
||||
expect(File.exist?(destination_filename)).to be_falsey
|
||||
subject.unzip(gzipped_filename, destination_filename)
|
||||
expect(File.exists?(destination_filename)).to be_truthy
|
||||
expect(File.exists?(gzipped_filename)).to be_truthy
|
||||
expect(File.exist?(destination_filename)).to be_truthy
|
||||
expect(File.exist?(gzipped_filename)).to be_truthy
|
||||
expect(File.read(destination_filename)).to eq File.read(unzipped_filename)
|
||||
end
|
||||
|
||||
@@ -46,10 +46,10 @@ RSpec.describe Dunlop::FileZip do
|
||||
context "mime-type: text/plain" do
|
||||
|
||||
it "copies the file to the provided filename" do
|
||||
expect(File.exists?(destination_filename)).to be_falsey
|
||||
expect(File.exist?(destination_filename)).to be_falsey
|
||||
subject.unzip(unzipped_filename, destination_filename)
|
||||
expect(File.exists?(destination_filename)).to be_truthy
|
||||
expect(File.exists?(unzipped_filename)).to be_truthy
|
||||
expect(File.exist?(destination_filename)).to be_truthy
|
||||
expect(File.exist?(unzipped_filename)).to be_truthy
|
||||
expect(File.read(destination_filename)).to eq File.read(unzipped_filename)
|
||||
end
|
||||
|
||||
@@ -69,10 +69,10 @@ RSpec.describe Dunlop::FileZip do
|
||||
end
|
||||
|
||||
it "gzips the file to the provided filename" do
|
||||
expect(File.exists?(gzipped_filename)).to be_falsey
|
||||
expect(File.exist?(gzipped_filename)).to be_falsey
|
||||
subject.gzip(unzipped_filename, gzipped_filename)
|
||||
expect(File.exists?(gzipped_filename)).to be_truthy
|
||||
expect(File.exists?(unzipped_filename)).to be_truthy
|
||||
expect(File.exist?(gzipped_filename)).to be_truthy
|
||||
expect(File.exist?(unzipped_filename)).to be_truthy
|
||||
|
||||
expect(File.size(unzipped_filename)).to eq 305
|
||||
expect(File.size(gzipped_filename)).to eq 153
|
||||
|
||||
Reference in New Issue
Block a user