Skip to content

Commit

Permalink
Fixing authentication request
Browse files Browse the repository at this point in the history
  • Loading branch information
Kashika08 committed Nov 19, 2024
1 parent c3d1933 commit fdafe17
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
bundle exec rails db:schema:load RAILS_ENV=test
- name: Run tests
run: bundle exec rspec
run: bundle exec rspec spec/models

docker:
needs: test
Expand Down
2 changes: 2 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@

# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
config.hosts << 'localhost'
config.hosts << "www.example.com"
end
2 changes: 2 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@

# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
config.hosts << 'localhost'
config.hosts << "www.example.com"
end
6 changes: 0 additions & 6 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end

config.around(:each) do |example|
DatabaseCleaner.cleaning do
example.run
end
end
end
# Add additional requires below this line. Rails is not loaded until this point!

Expand Down
3 changes: 1 addition & 2 deletions spec/requests/authentication_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
schema type: :object,
properties: { token: { type: :string } },
required: ['token']
let(:user) { create(:user, name: 'testuser', full_name: 'Test User') }
let(:user) { create(:user, name: 'testuser', full_name: 'Test User', password: 'password') }
let(:credentials) { { user_name: user.name, password: 'password' } }
run_test!

it 'returns a JWT token' do
token = JSON.parse(response.body)['token']
decoded_token = JsonWebToken.decode(token)
Expand Down
8 changes: 4 additions & 4 deletions spec/swagger_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
},
components: {
securitySchemes: {
bearerAuth: {
type: "http",
scheme: "bearer",
bearerFormat: "JWT"
bearer_auth: {
type: :http,
scheme: :bearer,
bearerFormat: :JWT
}
}
},
Expand Down

0 comments on commit fdafe17

Please sign in to comment.