Last active
March 14, 2017 00:17
-
-
Save belguzmani/1d04ed0cfb1029e1e018e3709217e2f3 to your computer and use it in GitHub Desktop.
Forms modeling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rspec.describe Form, type: :model do | |
it { is_expected.to belong_to(:user) } | |
it { is_expected.to have_field(:title) } | |
it { is_expected.to have_field(:require_signature) } | |
it { is_expected.to have_many(:form_shares) } | |
end | |
RSpec.describe FormShare, type: :model do | |
it { is_expected.to belong_to(:form) } | |
it { is_expected.to belong_to(:course) } | |
it { is_expected.to have_many(:signatures) } | |
end | |
RSpec.describe Signature, type: :model do | |
it { is_expected.to belong_to(:form_share) } | |
it { is_expected.to belong_to(:user) } | |
end | |
RSpec.describe Attachment, type: :model do | |
it { is_expected.to be_embedded_in(:attachable) } # polymorphic | |
it { is_expected.to have_field(:type) } | |
# mount picture_uploader | |
it { is_expected.to belong_to(:form) } | |
it { is_expected.to validate_inclusion_of(:type).to_allow(['picture','form']) } | |
end | |
RSpec.describe Event, type: :model do | |
it { is_expected.to embed_many(:attachments).with_alias(:attachable) } | |
end | |
RSpec.describe Message, type: :model do | |
it { is_expected.to embed_many(:attachments).with_alias(:attachable) } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment