Browse Source

rubocop

pull/64/head
magicmilo 3 years ago
parent
commit
073ccfe633
  1. 2
      Gemfile
  2. 2
      app/models/case_log.rb
  3. 8
      spec/models/case_log_spec.rb
  4. 3
      spec/rails_helper.rb

2
Gemfile

@ -49,10 +49,10 @@ end
group :test do
gem "capybara", require: false
gem "database_cleaner-active_record", require: false
gem "factory_bot_rails"
gem "selenium-webdriver", require: false
gem "simplecov", require: false
gem "database_cleaner-active_record", require: false
%w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib|
gem lib, git: "https://github.com/rspec/#{lib}.git", branch: "main", require: false
end

2
app/models/case_log.rb

@ -54,7 +54,7 @@ class CaseLogValidator < ActiveModel::Validator
record.errors.add :armed_forces_injured, "You must not answer the armed forces injury question if the tenant has not served in the armed forces or prefer not to say was chosen"
end
end
EMPLOYED_STATUSES = ["Full-time - 30 hours or more", "Part-time - Less than 30 hours"].freeze
def validate_net_income_uc_proportion(record)
(1..8).any? do |n|

8
spec/models/case_log_spec.rb

@ -115,7 +115,7 @@ RSpec.describe Form, type: :model do
}.to raise_error(ActiveRecord::RecordInvalid)
end
end
context "fixed term tenancy length" do
it "Must not be completed if Type of main tenancy is not responded with either Secure or Assured shorthold " do
expect {
@ -163,7 +163,7 @@ RSpec.describe Form, type: :model do
}.not_to raise_error
end
end
context "armed forces active validation" do
it "must be answered if ever served in the forces as a regular" do
expect {
@ -176,7 +176,7 @@ RSpec.describe Form, type: :model do
expect {
CaseLog.create!(armed_forces: "No",
armed_forces_active: "Yes")
}.to raise_error
}.to raise_error(ActiveRecord::RecordInvalid)
end
# Crossover over tests here as injured must be answered as well for no error
@ -185,7 +185,7 @@ RSpec.describe Form, type: :model do
CaseLog.create!(armed_forces: "Yes - a regular",
armed_forces_active: "Yes",
armed_forces_injured: "Yes")
}.not_to raise_error
}.not_to raise_error
end
end
end

3
spec/rails_helper.rb

@ -6,7 +6,7 @@ require File.expand_path("../config/environment", __dir__)
abort("The Rails environment is running in production mode!") if Rails.env.production?
require "rspec/rails"
require "capybara/rspec"
require 'database_cleaner/active_record'
require "database_cleaner/active_record"
# Comment to run `js: true specs` with visible browser interaction
Capybara.javascript_driver = :selenium_headless
@ -58,6 +58,7 @@ RSpec.configure do |config|
uncommitted transaction data setup over the spec's database connection.
MSG
end
DatabaseCleaner.clean_with(:truncation)
end

Loading…
Cancel
Save