Skip to content

Commit

Permalink
Merge pull request #475 from commercekitchen/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
tmichaelreis authored Jan 8, 2021
2 parents b768448 + b8a92f4 commit dcc72ce
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 4 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ practice for digital literacy trainers.

## Contributions

Please ask before opening a pull to add features, as we must weigh the impact against current
implementations of this code base.
If you find a bug, please open an issue.

That said, if you find a bug, please do open an issue!
Feel free to submit a Pull Request if you'd like to contribute. Follow instructions below to set up and run the application in a development environment. If you do choose to contribute, please include tests for your code and fix any formatting issues uncovered with RuboCop.

## Getting Started

Expand Down Expand Up @@ -39,6 +38,19 @@ required to stand up a new DigitalLearn site.

- `rails s`

In order to test subdomain functionality, consider using lvh.me:
Run server with `rails s -b lvh.me`, then visit `_subdomain_.lvh.me:3000`

Alternatively, you can create a tunnel to your localhost with [ngrok](https://github.com/inconshreveable/ngrok).

### Run Tests

- `rspec`

### Run rubocop linter

- `rubocop`

## Adding new Subsites

View the documentation on [Adding a new Subsite](/docs/adding_a_subsite.md)
2 changes: 1 addition & 1 deletion app/views/admin/invites/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<% resource.class.invite_key_fields.each do |field| -%>
<div class='inline-item'>
<%= f.label field, class: "text-color" %>
<%= f.text_field field %>
<%= f.text_field field, required: true %>
</div>
<% end -%>

Expand Down
48 changes: 48 additions & 0 deletions spec/features/admin/admin_invites_user_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

require 'feature_helper'

feature 'Admin user invites other admins' do
let(:org) { FactoryBot.create(:organization) }
let(:user) { FactoryBot.create(:user, :admin, organization: org) }

before(:each) do
switch_to_subdomain(org.subdomain)
login_as user
end

scenario 'submits blank form', js: true do
visit new_user_invitation_path
expect(page).to have_content 'Invite Admin'

click_button 'Send Invitation'

expect(current_path).to eq(new_user_invitation_path)
end

scenario 'attempts to invite user with invalid email' do
visit new_user_invitation_path
expect(page).to have_content 'Invite Admin'

fill_in 'Email', with: 'foobar notanemail'

click_button 'Send Invitation'

expect(page).to have_content('Email is invalid')
end

scenario 'invites user with valid email' do
visit new_user_invitation_path
expect(page).to have_content 'Invite Admin'

fill_in 'Email', with: '[email protected]'

click_button 'Send Invitation'

success_message = 'An invitation email has been sent to [email protected].'

expect(page).to have_content(success_message)
expect(current_path).to eq(root_path)
end

end

0 comments on commit dcc72ce

Please sign in to comment.