diff --git a/doorkeeper-openid_connect.gemspec b/doorkeeper-openid_connect.gemspec index 98bfe48..5a440ce 100644 --- a/doorkeeper-openid_connect.gemspec +++ b/doorkeeper-openid_connect.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency 'json-jwt', '~> 1.6' spec.add_development_dependency 'rspec-rails' - spec.add_development_dependency 'factory_girl' + spec.add_development_dependency 'factory_bot' spec.add_development_dependency 'sqlite3' spec.add_development_dependency 'pry-byebug' spec.add_development_dependency 'conventional-changelog', '~> 1.2' diff --git a/spec/factories.rb b/spec/factories.rb index 94da6fe..43c9344 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -1,29 +1,29 @@ -FactoryGirl.define do +FactoryBot.define do factory :access_grant, class: Doorkeeper::AccessGrant do resource_owner_id { create(:user).id } application - redirect_uri 'https://app.com/callback' - expires_in 100 - scopes 'public write' + redirect_uri { 'https://app.com/callback' } + expires_in { 100 } + scopes { 'public write' } end factory :access_token, class: Doorkeeper::AccessToken do resource_owner_id { create(:user).id } application - expires_in 2.hours + expires_in { 2.hours } factory :clientless_access_token do - application nil + application { nil } end end factory :application, class: Doorkeeper::Application do sequence(:name) { |n| "Application #{n}" } - redirect_uri 'https://app.com/callback' + redirect_uri { 'https://app.com/callback' } end factory :user do - current_sign_in_at Time.at(23) + current_sign_in_at { Time.at(23) } end factory :openid_request, class: Doorkeeper::OpenidConnect::Request do diff --git a/spec/lib/oauth/id_token_request_spec.rb b/spec/lib/oauth/id_token_request_spec.rb index 1d56ba7..796cd2e 100644 --- a/spec/lib/oauth/id_token_request_spec.rb +++ b/spec/lib/oauth/id_token_request_spec.rb @@ -58,8 +58,8 @@ it 'creates a new token if scopes do not match' do allow(Doorkeeper.configuration).to receive(:reuse_access_token).and_return(true) - FactoryGirl.create(:access_token, application_id: pre_auth.client.id, - resource_owner_id: owner.id, scopes: '') + create(:access_token, application_id: pre_auth.client.id, + resource_owner_id: owner.id, scopes: '') expect do subject.authorize end.to change { Doorkeeper::AccessToken.count }.by(1) @@ -70,8 +70,8 @@ allow(application.scopes).to receive(:has_scopes?).and_return(true) allow(application.scopes).to receive(:all?).and_return(true) - FactoryGirl.create(:access_token, application_id: pre_auth.client.id, - resource_owner_id: owner.id, scopes: 'public') + create(:access_token, application_id: pre_auth.client.id, + resource_owner_id: owner.id, scopes: 'public') expect { subject.authorize }.not_to change { Doorkeeper::AccessToken.count } end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 5196f07..590ac47 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -31,8 +31,8 @@ require_relative 'support/doorkeeper_configuration.rb' -require 'factory_girl' -FactoryGirl.find_definitions +require 'factory_bot' +FactoryBot.find_definitions RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures @@ -48,7 +48,7 @@ # arbitrary gems may also be filtered via: # config.filter_gems_from_backtrace("gem name") - config.include FactoryGirl::Syntax::Methods + config.include FactoryBot::Syntax::Methods # Reinitialize configuration after each example config.after :each do