Commit fb77d8e6 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Use skip_create so that create would act like build

parent 311fe2ad
FactoryGirl.define do
factory :geo_event_log_state, class: Geo::EventLogState do
skip_create
sequence(:event_id)
end
end
FactoryGirl.define do
factory :geo_project_registry, class: Geo::ProjectRegistry do
skip_create
project factory: :empty_project
last_repository_synced_at nil
last_repository_successful_sync_at nil
......
FactoryGirl.define do
factory :gitlab_license, class: "Gitlab::License" do
skip_create
starts_at { Date.today - 1.month }
expires_at { Date.today + 11.months }
notify_users_at { |l| l.expires_at }
......
......@@ -8,16 +8,12 @@ describe 'factories' do
end
it 'does not raise error when created' do
skip("#{factory.name} cannot be saved") unless build(factory.name).respond_to?(:save!)
expect { create(factory.name) }.not_to raise_error
end
factory.definition.defined_traits.map(&:name).each do |trait_name|
describe "linting #{trait_name} trait" do
skip 'does not raise error when created' do
skip("#{factory.name} cannot be saved") unless build(factory.name).respond_to?(:save!)
expect { create(factory.name, trait_name) }.not_to raise_error
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment