You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
573 B
18 lines
573 B
2 years ago
|
require "rails_helper"
|
||
|
|
||
|
RSpec.shared_examples "shared examples for derived fields" do |log_type|
|
||
|
describe "sets ethnic based on the value of ethnic_refused" do
|
||
|
it "is set to 17 when ethnic_group is 17" do
|
||
|
log = FactoryBot.build(log_type, ethnic_group: 17, ethnic: nil)
|
||
|
|
||
|
expect { log.set_derived_fields! }.to change(log, :ethnic).from(nil).to(17)
|
||
|
end
|
||
|
|
||
|
it "is is not modified otherwise" do
|
||
|
log = FactoryBot.build(log_type, ethnic_group: nil, ethnic: nil)
|
||
|
|
||
|
expect { log.set_derived_fields! }.not_to change(log, :ethnic)
|
||
|
end
|
||
|
end
|
||
|
end
|