Updated

spec/models/archived/petition / email_spec.rb

C
34 lines of codes
0 methods
N/A complexity/method
2 churn
120.66 complexity
43 duplications
require 'rails_helper' RSpec.describe Archived::Petition::Email, type: :model do it "has a valid factory" do expect(FactoryBot.build(:archived_petition_email)).to be_valid end describe "schema" do
  1. describe#schema has a flog score of 57
it { is_expected.to have_db_column(:petition_id).of_type(:integer) } it { is_expected.to have_db_column(:subject).of_type(:string).with_options(null: false) } it { is_expected.to have_db_column(:body).of_type(:text) } it { is_expected.to have_db_column(:sent_by).of_type(:string) } it { is_expected.to have_db_column(:created_at).of_type(:datetime).with_options(null: false) } it { is_expected.to have_db_column(:updated_at).of_type(:datetime).with_options(null: false) } end describe "associations" do it { is_expected.to belong_to(:petition) } end describe "indexes" do it { is_expected.to have_db_index([:petition_id]) } end describe "validations" do
  1. Similar code found in 2 nodes Locations: 0 1
  2. describe#validations has a flog score of 41
subject { FactoryBot.build(:archived_petition_email) } it { is_expected.to validate_presence_of(:petition) } it { is_expected.to validate_presence_of(:subject) } it { is_expected.to validate_length_of(:subject).is_at_most(100) } it { is_expected.to validate_presence_of(:body) } it { is_expected.to validate_length_of(:body).is_at_most(5000) } end end