main
1# frozen_string_literal: true
2
3require 'rails_helper'
4
5RSpec.describe '/my/clients' do
6 context "when logged in" do
7 let(:current_user) { create(:user) }
8
9 before { http_login(current_user) }
10
11 describe "GET /my/clients" do
12 before { get '/my/clients' }
13
14 specify { expect(response).to have_http_status(:ok) }
15 end
16
17 describe "GET /my/clients/new" do
18 before { get '/my/clients/new' }
19
20 specify { expect(response).to have_http_status(:ok) }
21 end
22
23 describe "POST /my/clients" do
24 context "when the request data is valid" do
25 let(:attributes) { attributes_for(:client) }
26
27 before { post '/my/clients', params: { client: attributes } }
28
29 specify { expect(response).to redirect_to(my_clients_path) }
30 specify { expect(flash[:notice]).to include('Client ID') }
31 specify { expect(flash[:notice]).to include('Client Secret') }
32 specify { expect(Client.count).to be(1) }
33 end
34 end
35 end
36end