Commit fe3d77ad6224e4ca88b99b1099f1364d9b87c5b8

Authored by Cyril Mougel
2 parents fb2e0ef0 40e9fa60
Exists in master and in 1 other branch production

Merge pull request #493 from nfedyashev/testing_factories_first

Test all factories
spec/fabricators_spec.rb 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +require 'spec_helper'
  2 +
  3 +Fabrication::Config.fabricator_dir.each do |folder|
  4 + Dir.glob(File.join(Rails.root, folder, '**', '*.rb')).each do |file|
  5 + require file
  6 + end
  7 +end
  8 +
  9 +describe "Fabrication" do
  10 + Fabrication::Fabricator.schematics.keys.sort.each do |fabricator_name|
  11 + context "Fabricate(:#{fabricator_name})" do
  12 + subject { Fabricate.build(fabricator_name) }
  13 +
  14 + it { should be_valid }
  15 + end
  16 + end
  17 +end
... ...
spec/models/problem_spec.rb
... ... @@ -3,9 +3,6 @@ require 'spec_helper'
3 3 describe Problem do
4 4 describe "Fabrication" do
5 5 context "Fabricate(:problem)" do
6   - it 'should be valid' do
7   - Fabricate.build(:problem).should be_valid
8   - end
9 6 it 'should have no comment' do
10 7 lambda do
11 8 Fabricate(:problem)
... ... @@ -14,9 +11,6 @@ describe Problem do
14 11 end
15 12  
16 13 context "Fabricate(:problem_with_comments)" do
17   - it 'should be valid' do
18   - Fabricate.build(:problem_with_comments).should be_valid
19   - end
20 14 it 'should have 3 comments' do
21 15 lambda do
22 16 Fabricate(:problem_with_comments)
... ... @@ -25,9 +19,6 @@ describe Problem do
25 19 end
26 20  
27 21 context "Fabricate(:problem_with_errs)" do
28   - it 'should be valid' do
29   - Fabricate.build(:problem_with_errs).should be_valid
30   - end
31 22 it 'should have 3 errs' do
32 23 lambda do
33 24 Fabricate(:problem_with_errs)
... ...