Commit 1c9fab7e91a2bcee251ba05fa55758dc4e2d0523
1 parent
396c3388
Exists in
master
and in
1 other branch
Upgrade fabrication gem to 2.8.1 version
Showing
13 changed files
with
29 additions
and
23 deletions
Show diff stats
Gemfile
@@ -20,8 +20,7 @@ gem 'strong_parameters' | @@ -20,8 +20,7 @@ gem 'strong_parameters' | ||
20 | gem 'actionmailer_inline_css' | 20 | gem 'actionmailer_inline_css' |
21 | gem 'kaminari', '>= 0.14.1' | 21 | gem 'kaminari', '>= 0.14.1' |
22 | gem 'rack-ssl-enforcer', :require => false | 22 | gem 'rack-ssl-enforcer', :require => false |
23 | -# fabrication 1.3.0 is last supporting ruby 1.8. Update when stop supporting this version too | ||
24 | -gem 'fabrication', "~> 1.3.0" # Used for both tests and demo data | 23 | +gem 'fabrication' |
25 | gem 'rails_autolink' | 24 | gem 'rails_autolink' |
26 | # Please don't update hoptoad_notifier to airbrake. | 25 | # Please don't update hoptoad_notifier to airbrake. |
27 | # It's for internal use only, and we monkeypatch certain methods | 26 | # It's for internal use only, and we monkeypatch certain methods |
Gemfile.lock
@@ -109,7 +109,7 @@ GEM | @@ -109,7 +109,7 @@ GEM | ||
109 | mail (~> 2.2) | 109 | mail (~> 2.2) |
110 | erubis (2.7.0) | 110 | erubis (2.7.0) |
111 | execjs (2.0.1) | 111 | execjs (2.0.1) |
112 | - fabrication (1.3.2) | 112 | + fabrication (2.8.1) |
113 | faraday (0.8.8) | 113 | faraday (0.8.8) |
114 | multipart-post (~> 1.2.0) | 114 | multipart-post (~> 1.2.0) |
115 | faraday_middleware (0.9.0) | 115 | faraday_middleware (0.9.0) |
@@ -404,7 +404,7 @@ DEPENDENCIES | @@ -404,7 +404,7 @@ DEPENDENCIES | ||
404 | devise (~> 2.2.1) | 404 | devise (~> 2.2.1) |
405 | email_spec | 405 | email_spec |
406 | execjs | 406 | execjs |
407 | - fabrication (~> 1.3.0) | 407 | + fabrication |
408 | flowdock | 408 | flowdock |
409 | foreman | 409 | foreman |
410 | gitlab! | 410 | gitlab! |
app/models/backtrace.rb
spec/fabricators/app_fabricator.rb
@@ -10,18 +10,18 @@ Fabricator(:app_with_watcher, :from => :app) do | @@ -10,18 +10,18 @@ Fabricator(:app_with_watcher, :from => :app) do | ||
10 | end | 10 | end |
11 | 11 | ||
12 | Fabricator(:watcher) do | 12 | Fabricator(:watcher) do |
13 | - app! | 13 | + app |
14 | watcher_type 'email' | 14 | watcher_type 'email' |
15 | email { sequence(:email){|n| "email#{n}@example.com"} } | 15 | email { sequence(:email){|n| "email#{n}@example.com"} } |
16 | end | 16 | end |
17 | 17 | ||
18 | Fabricator(:user_watcher, :from => :watcher) do | 18 | Fabricator(:user_watcher, :from => :watcher) do |
19 | - user! | 19 | + user |
20 | watcher_type 'user' | 20 | watcher_type 'user' |
21 | end | 21 | end |
22 | 22 | ||
23 | Fabricator(:deploy) do | 23 | Fabricator(:deploy) do |
24 | - app! | 24 | + app |
25 | username 'clyde.frog' | 25 | username 'clyde.frog' |
26 | repository 'git@github.com/errbit/errbit.git' | 26 | repository 'git@github.com/errbit/errbit.git' |
27 | environment 'production' | 27 | environment 'production' |
spec/fabricators/comment_fabricator.rb
spec/fabricators/err_fabricator.rb
1 | Fabricator :err do | 1 | Fabricator :err do |
2 | - problem! | 2 | + problem |
3 | fingerprint 'some-finger-print' | 3 | fingerprint 'some-finger-print' |
4 | end | 4 | end |
5 | 5 | ||
6 | Fabricator :notice do | 6 | Fabricator :notice do |
7 | - err! | 7 | + err |
8 | message 'FooError: Too Much Bar' | 8 | message 'FooError: Too Much Bar' |
9 | - backtrace! | 9 | + backtrace |
10 | server_environment { {'environment-name' => 'production'} } | 10 | server_environment { {'environment-name' => 'production'} } |
11 | request {{ 'component' => 'foo', 'action' => 'bar' }} | 11 | request {{ 'component' => 'foo', 'action' => 'bar' }} |
12 | notifier {{ 'name' => 'Notifier', 'version' => '1', 'url' => 'http://toad.com' }} | 12 | notifier {{ 'name' => 'Notifier', 'version' => '1', 'url' => 'http://toad.com' }} |
13 | end | 13 | end |
14 | 14 | ||
15 | Fabricator :backtrace do | 15 | Fabricator :backtrace do |
16 | - fingerprint "fingerprint" | ||
17 | lines(:count => 99) { Fabricate.build(:backtrace_line) } | 16 | lines(:count => 99) { Fabricate.build(:backtrace_line) } |
18 | end | 17 | end |
19 | 18 |
spec/fabricators/issue_tracker_fabricator.rb
spec/fabricators/notification_service_fabricator.rb
spec/fabricators/problem_fabricator.rb
spec/models/app_spec.rb
@@ -174,8 +174,11 @@ describe App do | @@ -174,8 +174,11 @@ describe App do | ||
174 | } | 174 | } |
175 | 175 | ||
176 | it 'returns the correct err if one already exists' do | 176 | it 'returns the correct err if one already exists' do |
177 | - existing = Fabricate(:err, conditions.merge(:problem => Fabricate(:problem, :app => app))) | ||
178 | - Err.where(conditions).first.should == existing | 177 | + existing = Fabricate(:err, { |
178 | + :problem => Fabricate(:problem, :app => app), | ||
179 | + :fingerprint => conditions[:fingerprint] | ||
180 | + }) | ||
181 | + Err.where(:fingerprint => conditions[:fingerprint]).first.should == existing | ||
179 | app.find_or_create_err!(conditions).should == existing | 182 | app.find_or_create_err!(conditions).should == existing |
180 | end | 183 | end |
181 | 184 |
spec/models/backtrace_spec.rb
@@ -11,7 +11,12 @@ describe Backtrace do | @@ -11,7 +11,12 @@ describe Backtrace do | ||
11 | end | 11 | end |
12 | 12 | ||
13 | context "similar backtrace exist" do | 13 | context "similar backtrace exist" do |
14 | - let!(:similar_backtrace) { Fabricate(:backtrace, :fingerprint => fingerprint) } | 14 | + let!(:similar_backtrace) { |
15 | + b = Fabricate(:backtrace) | ||
16 | + b.fingerprint = fingerprint | ||
17 | + b.save! | ||
18 | + b | ||
19 | + } | ||
15 | let(:fingerprint) { "fingerprint" } | 20 | let(:fingerprint) { "fingerprint" } |
16 | 21 | ||
17 | before { subject.stub(:fingerprint => fingerprint) } | 22 | before { subject.stub(:fingerprint => fingerprint) } |
spec/models/err_spec.rb
@@ -10,7 +10,7 @@ describe Err do | @@ -10,7 +10,7 @@ describe Err do | ||
10 | end | 10 | end |
11 | 11 | ||
12 | it 'requires a problem' do | 12 | it 'requires a problem' do |
13 | - err = Fabricate.build(:err, :problem_id => nil) | 13 | + err = Fabricate.build(:err, :problem_id => nil, :problem => nil) |
14 | err.should_not be_valid | 14 | err.should_not be_valid |
15 | err.errors[:problem_id].should include("can't be blank") | 15 | err.errors[:problem_id].should include("can't be blank") |
16 | end | 16 | end |
spec/models/fabricators_spec.rb
1 | require 'spec_helper' | 1 | require 'spec_helper' |
2 | 2 | ||
3 | -Fabrication::Config.fabricator_dir.each do |folder| | 3 | +Fabrication::Config.fabricator_path.each do |folder| |
4 | Dir.glob(File.join(Rails.root, folder, '**', '*.rb')).each do |file| | 4 | Dir.glob(File.join(Rails.root, folder, '**', '*.rb')).each do |file| |
5 | require file | 5 | require file |
6 | end | 6 | end |
@@ -8,7 +8,7 @@ end | @@ -8,7 +8,7 @@ end | ||
8 | 8 | ||
9 | describe "Fabrication" do | 9 | describe "Fabrication" do |
10 | #TODO : when 1.8.7 drop support se directly Symbol#sort | 10 | #TODO : when 1.8.7 drop support se directly Symbol#sort |
11 | - Fabrication::Fabricator.schematics.keys.sort_by(&:to_s).each do |fabricator_name| | 11 | + Fabrication.manager.schematics.keys.sort.each do |fabricator_name| |
12 | context "Fabricate(:#{fabricator_name})" do | 12 | context "Fabricate(:#{fabricator_name})" do |
13 | subject { Fabricate.build(fabricator_name) } | 13 | subject { Fabricate.build(fabricator_name) } |
14 | 14 |