summaryrefslogtreecommitdiff
path: root/spec/factories_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-03-29 13:39:27 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-03-30 10:44:18 +0200
commitd08de5ed0e894b4d201a7737db630667b9760a35 (patch)
treeae781f7c2da1d89aebe858d6bfaba91acc03aee7 /spec/factories_spec.rb
parentf2674c7b98c69668093583e4590223b7040b5b33 (diff)
downloadgitlab-ce-d08de5ed0e894b4d201a7737db630667b9760a35.tar.gz
Add support for not Active Record based factories
Diffstat (limited to 'spec/factories_spec.rb')
-rw-r--r--spec/factories_spec.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/spec/factories_spec.rb b/spec/factories_spec.rb
index 457859dedaf..62de081661d 100644
--- a/spec/factories_spec.rb
+++ b/spec/factories_spec.rb
@@ -1,9 +1,17 @@
require 'spec_helper'
-FactoryGirl.factories.map(&:name).each do |factory_name|
- describe "#{factory_name} factory" do
- it 'should be valid' do
- expect(build(factory_name)).to be_valid
+describe 'factories' do
+ FactoryGirl.factories.each do |factory|
+ describe "#{factory.name} factory" do
+ let(:entity) { build(factory.name) }
+
+ it 'does not raise error when created 'do
+ expect { entity }.to_not raise_error
+ end
+
+ it 'should be valid', if: factory.build_class < ActiveRecord::Base do
+ expect(entity).to be_valid
+ end
end
end
end