Sha256: 9b083226ebfddaa2f175c62194cafb13bbd672e2b988b6ce3d964c8c3b1fa92c

Contents?: true

Size: 923 Bytes

Versions: 3

Compression:

Stored size: 923 Bytes

Contents

require 'rails_helper'

module SocialFramework
  RSpec.describe Users::RegistrationsController, type: :controller do
  	include Devise::TestHelpers
    routes {SocialFramework::Engine.routes}

    describe "Permit username attribute" do
      it "Sign up with username" do
        request.env["devise.mapping"] = Devise.mappings[:user]
        
        post :create, user: {
          username: "user", email: "user@email.com", password: "password", password_confirmation: "password"
        }

        expect(response).to have_http_status(302)
      end

      it "Account update with username" do
        request.env["devise.mapping"] = Devise.mappings[:user]
        
        user = create(:user)
        sign_in user
        put :update, user: {
          username: "user1", email: "user1@email.com", current_password: "password"
        }

        expect(response).to have_http_status(302)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
social_framework-1.0.1 spec/controllers/social_framework/registration_controller_spec.rb
social_framework-0.0.3 spec/controllers/social_framework/registration_controller_spec.rb
social_framework-0.0.2 spec/controllers/social_framework/registration_controller_spec.rb