diff --git a/.travis.yml b/.travis.yml index 722d653a..0c2beb93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ language: ruby cache: bundler rvm: + - 3.1 + - 3.0 - 2.7 - 2.6 gemfile: @@ -8,6 +10,8 @@ gemfile: - gemfiles/rails_5.gemfile - gemfiles/rails_6.gemfile - gemfiles/rails_6.1.gemfile + - gemfiles/rails_7.gemfile + before_script: - bin/rails db:migrate RAILS_ENV=test before_install: diff --git a/Appraisals b/Appraisals index 430a3fb1..ad2baaeb 100644 --- a/Appraisals +++ b/Appraisals @@ -9,3 +9,7 @@ end appraise "rails-6.1" do gem "rails", "~> 6.1" end + +appraise "rails-7" do + gem "rails", "~> 7.0" +end diff --git a/Gemfile b/Gemfile index 17a65279..d3d4c2e6 100644 --- a/Gemfile +++ b/Gemfile @@ -10,5 +10,5 @@ gemspec # Git. Remember to move these dependencies to your gemspec before releasing # your gem to rubygems.org. -gem "rails", "~> 6.1", ">= 6.0" +gem "rails", ">= 6.1" gem 'pry', group: [:development, :test] diff --git a/app/controllers/scim_rails/scim_users_controller.rb b/app/controllers/scim_rails/scim_users_controller.rb index d0acb4fe..b77d2308 100644 --- a/app/controllers/scim_rails/scim_users_controller.rb +++ b/app/controllers/scim_rails/scim_users_controller.rb @@ -43,12 +43,12 @@ def create end def show - user = @company.public_send(ScimRails.config.scim_users_scope).find(params[:id]) + user = find_user json_scim_response(object: user) end def put_update - user = @company.public_send(ScimRails.config.scim_users_scope).find(params[:id]) + user = find_user update_status(user) unless put_active_param.nil? user.update!(permitted_user_params) json_scim_response(object: user) @@ -57,13 +57,17 @@ def put_update # TODO: PATCH will only deprovision or reprovision users. # This will work just fine for Okta but is not SCIM compliant. def patch_update - user = @company.public_send(ScimRails.config.scim_users_scope).find(params[:id]) + user = find_user update_status(user) json_scim_response(object: user) end private + def find_user + @company.public_send(ScimRails.config.scim_users_scope).find(params[:id]) + end + def permitted_user_params ScimRails.config.mutable_user_attributes.each.with_object({}) do |attribute, hash| hash[attribute] = find_value_for(attribute) diff --git a/gemfiles/rails_7.gemfile b/gemfiles/rails_7.gemfile new file mode 100644 index 00000000..f8d6e8cd --- /dev/null +++ b/gemfiles/rails_7.gemfile @@ -0,0 +1,8 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 7.0" +gem "pry", group: [:development, :test] + +gemspec path: "../" diff --git a/lib/scim_rails/version.rb b/lib/scim_rails/version.rb index 4d652621..38706464 100644 --- a/lib/scim_rails/version.rb +++ b/lib/scim_rails/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ScimRails - VERSION = "0.4.0" + VERSION = "0.4.1" end diff --git a/scim_rails.gemspec b/scim_rails.gemspec index 7472ea65..d875a6bb 100644 --- a/scim_rails.gemspec +++ b/scim_rails.gemspec @@ -16,8 +16,8 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] - s.required_ruby_version = "~> 2.4" - s.add_dependency "rails", ">= 5.0", "< 6.2" + s.required_ruby_version = ">= 2.4" + s.add_dependency "rails", ">= 6.0", "< 8" s.add_runtime_dependency "jwt", ">= 1.5" s.test_files = Dir["spec/**/*"] @@ -25,6 +25,6 @@ Gem::Specification.new do |s| s.add_development_dependency "bundler", "~> 2.0" s.add_development_dependency "factory_bot_rails" s.add_development_dependency "rake", "~> 13.0" - s.add_development_dependency "rspec-rails", "~> 5.0" + s.add_development_dependency "rspec-rails", "~> 6.0" s.add_development_dependency "sqlite3", "~> 1.3", "< 1.5" end diff --git a/spec/dummy/config/initializers/assets.rb b/spec/dummy/config/initializers/assets.rb index 01ef3e66..2e54d952 100644 --- a/spec/dummy/config/initializers/assets.rb +++ b/spec/dummy/config/initializers/assets.rb @@ -1,7 +1,7 @@ # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' +#Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path # Rails.application.config.assets.paths << Emoji.images_path diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index 395e9b85..89b7c677 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -2,32 +2,32 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20181206184313) do +ActiveRecord::Schema.define(version: 2018_12_06_184313) do create_table "companies", force: :cascade do |t| - t.string "name", null: false - t.string "subdomain", null: false - t.string "api_token", null: false + t.string "name", null: false + t.string "subdomain", null: false + t.string "api_token", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "users", force: :cascade do |t| - t.string "first_name", null: false - t.string "last_name", null: false - t.string "email", null: false - t.integer "company_id" + t.string "first_name", null: false + t.string "last_name", null: false + t.string "email", null: false + t.integer "company_id" t.datetime "archived_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end end