Add Submit Button to Integrations Tab (#2863)
* Add Submit Button to Integrations Tab Was just browsing around dev.to and realized there wasn't a submit button on this page, so I added one! I tried to get a system spec stood up but ran into issues with hitting the GitHub API that wasn't mocked out. I didn't spend enough time getting the correct mocking to work, but I might try to get that pushed up too. * Get the mocking working with a sample repo * Rewrite some of the rspec contexts
This commit is contained in:
parent
265dc3761b
commit
4680dd2835
2 changed files with 39 additions and 0 deletions
|
|
@ -15,4 +15,6 @@
|
|||
</div>
|
||||
<p><em>Add your Twitch username, and then checkout <a href="/live/<%= @user.username %>">dev.to/live/<%= @user.username %></a>.</em></p>
|
||||
<p><em>It's a new thing we're trying out. Soon we'll be able to indicate when any community member is currently streaming.</em></p>
|
||||
|
||||
<%= f.submit "SUBMIT", class: "cta" %>
|
||||
<% end %>
|
||||
|
|
|
|||
37
spec/system/user/user_edits_integrations_spec.rb
Normal file
37
spec/system/user/user_edits_integrations_spec.rb
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe "User edits their integrations", type: :system, js: true do
|
||||
let(:user) { create(:user, saw_onboarding: true) }
|
||||
let(:github_response_body) do
|
||||
[
|
||||
{
|
||||
"id" => 1_296_269,
|
||||
"node_id" => "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
||||
"name" => "Hello-World",
|
||||
"full_name" => "octocat/Hello-World"
|
||||
},
|
||||
]
|
||||
end
|
||||
|
||||
before do
|
||||
sign_in user
|
||||
stub_request(:get, "https://api.github.com/user/repos?per_page=100").to_return(status: 200, body: github_response_body.to_json, headers: { "Content-Type" => "application/json" })
|
||||
end
|
||||
|
||||
describe "via visiting /settings" do
|
||||
it "and sets a Twitch Username" do
|
||||
visit "/settings"
|
||||
expect(page).to have_current_path("/settings")
|
||||
|
||||
click_link "Integrations"
|
||||
|
||||
fill_in "Twitch Username", with: "TestTwitchUser"
|
||||
click_button("SUBMIT")
|
||||
|
||||
expect(page).to have_content "Your profile was successfully updated."
|
||||
|
||||
click_link "Integrations"
|
||||
expect(find_field("Twitch Username").value).to eq "TestTwitchUser"
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue