BigW Consortium Gitlab

factories_spec.rb 670 Bytes
Newer Older
1 2
require 'spec_helper'

3 4 5
describe 'factories' do
  FactoryGirl.factories.each do |factory|
    describe "#{factory.name} factory" do
6 7 8
      it 'does not raise error when built' do
        expect { build(factory.name) }.not_to raise_error
      end
9

10
      it 'does not raise error when created' do
11
        expect { create(factory.name) }.not_to raise_error
12 13
      end

14 15 16 17 18 19
      factory.definition.defined_traits.map(&:name).each do |trait_name|
        describe "linting #{trait_name} trait" do
          skip 'does not raise error when created' do
            expect { create(factory.name, trait_name) }.not_to raise_error
          end
        end
20
      end
21 22 23
    end
  end
end