Commit f95ac763eea7b3f1c02eee68d92311e6920da175
1 parent
a308ea35
Exists in
master
and in
1 other branch
fix spec/controller/deploy_controller with fabrication_gem
Showing
3 changed files
with
5 additions
and
7 deletions
Show diff stats
spec/controllers/deploys_controller_spec.rb
| @@ -12,7 +12,7 @@ describe DeploysController do | @@ -12,7 +12,7 @@ describe DeploysController do | ||
| 12 | 'scm_revision' => '19d77837eef37902cf5df7e4445c85f392a8d0d5', | 12 | 'scm_revision' => '19d77837eef37902cf5df7e4445c85f392a8d0d5', |
| 13 | 'message' => 'johns first deploy' | 13 | 'message' => 'johns first deploy' |
| 14 | } | 14 | } |
| 15 | - @app = Factory(:app_with_watcher, :notify_on_deploys => true, :api_key => 'APIKEY') | 15 | + @app = Fabricate(:app_with_watcher, :notify_on_deploys => true, :api_key => 'APIKEY') |
| 16 | end | 16 | end |
| 17 | 17 | ||
| 18 | it 'finds the app via the api key' do | 18 | it 'finds the app via the api key' do |
| @@ -30,7 +30,7 @@ describe DeploysController do | @@ -30,7 +30,7 @@ describe DeploysController do | ||
| 30 | :revision => '19d77837eef37902cf5df7e4445c85f392a8d0d5', | 30 | :revision => '19d77837eef37902cf5df7e4445c85f392a8d0d5', |
| 31 | :message => 'johns first deploy' | 31 | :message => 'johns first deploy' |
| 32 | 32 | ||
| 33 | - }).and_return(Factory(:deploy)) | 33 | + }).and_return(Fabricate(:deploy)) |
| 34 | post :create, :deploy => @params, :api_key => 'APIKEY' | 34 | post :create, :deploy => @params, :api_key => 'APIKEY' |
| 35 | end | 35 | end |
| 36 | 36 | ||
| @@ -45,8 +45,8 @@ describe DeploysController do | @@ -45,8 +45,8 @@ describe DeploysController do | ||
| 45 | 45 | ||
| 46 | context "GET #index" do | 46 | context "GET #index" do |
| 47 | before(:each) do | 47 | before(:each) do |
| 48 | - @deploy = Factory :deploy | ||
| 49 | - sign_in Factory(:admin) | 48 | + @deploy = Fabricate :deploy |
| 49 | + sign_in Fabricate(:admin) | ||
| 50 | get :index, :app_id => @deploy.app.id | 50 | get :index, :app_id => @deploy.app.id |
| 51 | end | 51 | end |
| 52 | 52 |
spec/fabricators/app_fabricator.rb
| @@ -9,7 +9,7 @@ end | @@ -9,7 +9,7 @@ end | ||
| 9 | Fabricator(:watcher) do | 9 | Fabricator(:watcher) do |
| 10 | app! | 10 | app! |
| 11 | watcher_type 'email' | 11 | watcher_type 'email' |
| 12 | - email { sequence(:email) } | 12 | + email { sequence(:email){|n| "email#{n}@example.com"} } |
| 13 | end | 13 | end |
| 14 | 14 | ||
| 15 | Fabricator(:user_watcher, :from => :watcher) do | 15 | Fabricator(:user_watcher, :from => :watcher) do |
spec/fabricators/sequences_fabricator.rb
| 1 | Fabricate.sequence(:name) {|n| "John #{n} Doe"} | 1 | Fabricate.sequence(:name) {|n| "John #{n} Doe"} |
| 2 | Fabricate.sequence(:word) {|n| "word#{n}"} | 2 | Fabricate.sequence(:word) {|n| "word#{n}"} |
| 3 | -Fabricate.sequence(:email) {|n| "email#{n}@example.com"} | ||
| 4 | -Fabricate.sequence(:user_email) {|n| "user.#{n}@example.com"} | ||
| 5 | 3 |