about summary refs log tree commit diff
path: root/spec/models/block_spec.rb
diff options
context:
space:
mode:
authorJantsoP <jantso.porali@gmail.com>2017-04-05 10:07:17 +0200
committerGitHub <noreply@github.com>2017-04-05 10:07:17 +0200
commit20b53e6add351e5bb5ff1bd4d675db6252e03293 (patch)
treee252e354e63765d1f28919f2ac58de26001806cb /spec/models/block_spec.rb
parent3ec221d3b7093e2a2606ec04036cca9e9f1f733d (diff)
parentccb6a658fd1a2e596c95d5b8e7a39f72a5f5b14b (diff)
Merge branch 'master' into master
Diffstat (limited to 'spec/models/block_spec.rb')
-rw-r--r--spec/models/block_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/block_spec.rb b/spec/models/block_spec.rb
index 6862de6fc..cabb41c3e 100644
--- a/spec/models/block_spec.rb
+++ b/spec/models/block_spec.rb
@@ -1,5 +1,22 @@
 require 'rails_helper'
 
 RSpec.describe Block, type: :model do
+  describe 'validations' do
+    it 'has a valid fabricator' do
+      block = Fabricate.build(:block)
+      expect(block).to be_valid
+    end
 
+    it 'is invalid without an account' do
+      block = Fabricate.build(:block, account: nil)
+      block.valid?
+      expect(block).to model_have_error_on_field(:account)
+    end
+
+    it 'is invalid without a target_account' do
+      block = Fabricate.build(:block, target_account: nil)
+      block.valid?
+      expect(block).to model_have_error_on_field(:target_account)
+    end
+  end
 end