Skip to content

Commit

Permalink
Merge pull request RefugeRestrooms#412 from RefugeRestrooms/update-to…
Browse files Browse the repository at this point in the history
…-factory-bot

update factory girl to factory bot
  • Loading branch information
mi-wood authored Jan 7, 2018
2 parents 5df23f5 + 87c78d2 commit 28340b4
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ gem 'activeadmin', '~> 1.0.0'

group :development, :test do
gem 'rspec-rails'
gem 'factory_girl_rails', '~> 4.0'
gem 'factory_bot_rails', '~> 4.8.2'
gem 'dotenv-rails', '~> 2.2.1'
gem 'pry'
gem 'better_errors', '~> 2.4.0'
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ GEM
equalizer (0.0.11)
erubi (1.7.0)
execjs (2.7.0)
factory_girl (4.9.0)
factory_bot (4.8.2)
activesupport (>= 3.0.0)
factory_girl_rails (4.9.0)
factory_girl (~> 4.9.0)
factory_bot_rails (4.8.2)
factory_bot (~> 4.8.2)
railties (>= 3.0.0)
ffi (1.9.18)
formtastic (3.1.5)
Expand Down Expand Up @@ -400,7 +400,7 @@ DEPENDENCIES
database_cleaner
devise (~> 4.3)
dotenv-rails (~> 2.2.1)
factory_girl_rails (~> 4.0)
factory_bot_rails (~> 4.8.2)
geocoder (~> 1.2.1)
grape (= 0.7.0)
grape-kaminari
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/restroom_steps.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Given(/^a restroom exists in Winnipeg$/) do
FactoryGirl.create(:restroom, {name: 'Winnipeg restroom', street: '91 Albert St.', city: 'Winnipeg', state: 'MB', country: 'Canada'}.merge(locations[:Winnipeg]))
FactoryBot.create(:restroom, {name: 'Winnipeg restroom', street: '91 Albert St.', city: 'Winnipeg', state: 'MB', country: 'Canada'}.merge(locations[:Winnipeg]))
end

Then(/^I should( not)? see a restroom$/) do |negation|
Expand Down
34 changes: 17 additions & 17 deletions spec/api/v1/restrooms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe "Restrooms API", type: :request do
it 'sends a list of restrooms order by date descending' do
FactoryGirl.create_list(:restroom, 15)
FactoryBot.create_list(:restroom, 15)

get '/api/v1/restrooms'
expect(response).to be_success
Expand All @@ -19,7 +19,7 @@
end

it 'paginates list of restrooms by 10 results' do
FactoryGirl.create_list(:restroom, 15)
FactoryBot.create_list(:restroom, 15)

get '/api/v1/restrooms'
expect(response).to be_success
Expand All @@ -35,10 +35,10 @@

context 'filters' do
before :each do
FactoryGirl.create_list(:restroom, 5)
FactoryGirl.create_list(:unisex_restroom, 5)
FactoryGirl.create_list(:ada_restroom, 5)
FactoryGirl.create_list(:unisex_and_ada_restroom, 5)
FactoryBot.create_list(:restroom, 5)
FactoryBot.create_list(:unisex_restroom, 5)
FactoryBot.create_list(:ada_restroom, 5)
FactoryBot.create_list(:unisex_and_ada_restroom, 5)
end

let(:json) { JSON.parse(response.body) }
Expand Down Expand Up @@ -81,10 +81,10 @@
end

it 'full-text searches a list of restrooms' do
FactoryGirl.create(:restroom)
FactoryGirl.create(:restroom, name: 'Frankie\'s Coffee Shop')
FactoryGirl.create(:restroom, name: 'Hipster Coffee Shop')
FactoryGirl.create(:restroom, name: 'Organic Co. Coffee', comment: 'Pretty tile.')
FactoryBot.create(:restroom)
FactoryBot.create(:restroom, name: 'Frankie\'s Coffee Shop')
FactoryBot.create(:restroom, name: 'Hipster Coffee Shop')
FactoryBot.create(:restroom, name: 'Organic Co. Coffee', comment: 'Pretty tile.')

get '/api/v1/restrooms/search', params: { query: 'Coffee Shop' }
json = JSON.parse(response.body)
Expand All @@ -107,7 +107,7 @@
end

it 'paginates full-text searches a list of restrooms by 10 results' do
FactoryGirl.create_list(:restroom, 15)
FactoryBot.create_list(:restroom, 15)

get '/api/v1/restrooms/search', params: { query: 'San Francisco' }
expect(response).to be_success
Expand All @@ -123,10 +123,10 @@

context "queries" do
before :each do
FactoryGirl.create(:restroom)
FactoryGirl.create(:unisex_restroom, name: 'Frankie\'s Coffee Shop')
FactoryGirl.create(:ada_restroom, name: 'Hipster Coffee Shop')
FactoryGirl.create(:unisex_and_ada_restroom, name: 'Organic Co. Coffee', comment: 'Pretty tile.')
FactoryBot.create(:restroom)
FactoryBot.create(:unisex_restroom, name: 'Frankie\'s Coffee Shop')
FactoryBot.create(:ada_restroom, name: 'Hipster Coffee Shop')
FactoryBot.create(:unisex_and_ada_restroom, name: 'Organic Co. Coffee', comment: 'Pretty tile.')
end

let(:json) { JSON.parse(response.body) }
Expand Down Expand Up @@ -177,7 +177,7 @@

context "filters a list of restrooms by updated date" do
before :each do
FactoryGirl.create(:restroom, created_at: 1.day.ago)
FactoryBot.create(:restroom, created_at: 1.day.ago)
get "/api/v1/restrooms/by_date", params: { updated: true, day: Date.today.day, month: Date.today.month, year: Date.today.year }
end

Expand All @@ -192,7 +192,7 @@

context "filters a list of restrooms by created date" do
before :each do
FactoryGirl.create(:restroom, created_at: 1.week.ago)
FactoryBot.create(:restroom, created_at: 1.week.ago)
get "/api/v1/restrooms/by_date", params: { day: Date.today.day, month: Date.today.month, year: Date.today.year }
end

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/restrooms_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
end

context "voting" do
let(:restroom) { FactoryGirl.create(:restroom) }
let(:restroom) { FactoryBot.create(:restroom) }

it "should downvote" do
post_params = {
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/restrooms.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :restroom do
name 'Moonlight Café'
street '123 Example St.'
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
# --seed 1234
config.order = "random"

# Include FactoryGirl methods into the RSpec test suite.
config.include FactoryGirl::Syntax::Methods
# Include FactoryBot methods into the RSpec test suite.
config.include FactoryBot::Syntax::Methods
end

Geocoder.configure(:lookup => :test)
Expand Down

0 comments on commit 28340b4

Please sign in to comment.