-
Notifications
You must be signed in to change notification settings - Fork 12
add test for Facilitators submitting a workshop idea #612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
|
|
||
| require 'rails_helper' | ||
|
|
||
| RSpec.describe "Facilitators can submit a workshop idea", type: :system do | ||
| describe "Navigate to Workshop Idea page" do | ||
| context "When Facilitator is logged in" do | ||
| before do | ||
| create(:windows_type, :adult) | ||
| create(:windows_type, :children) | ||
| create(:windows_type, :combined) | ||
|
|
||
| user = create(:user) | ||
| create(:facilitator, user: user) | ||
| sign_in user | ||
|
|
||
| visit new_workshop_idea_path | ||
| end | ||
|
|
||
| it "shows the new workshop form" do | ||
| expect(page).to have_content("New Workshop idea") | ||
| end | ||
|
|
||
| it "submits the form when clicking Submit" do | ||
| fill_in 'workshop_idea_title', with: 'My Amazing Workshop' | ||
| select 'ADULT WINDOWS', from: 'workshop_idea_windows_type_id' | ||
| # select 'Adult', from:'workshop_idea_age_range' | ||
| fill_in 'workshop_idea_objective', with: 'Learn something new' | ||
| fill_in 'workshop_idea_description', with: 'This is a test workshop description.' | ||
| fill_in 'workshop_idea_materials', with: 'Paper, markers' | ||
| fill_in 'workshop_idea_optional_materials', with: 'Scissors, glue' | ||
| fill_in 'workshop_idea_setup', with: 'Arrange tables' | ||
| fill_in 'workshop_idea_introduction', with: 'Start with a story' | ||
| fill_in 'workshop_idea_time_intro', with: 10 | ||
| fill_in 'workshop_idea_opening_circle', with: 'Welcome and warm up' | ||
| fill_in 'workshop_idea_time_opening_circle', with: 5 | ||
| fill_in 'workshop_idea_demonstration', with: 'Show how it works' | ||
| fill_in 'workshop_idea_time_demonstration', with: 15 | ||
| fill_in 'workshop_idea_warm_up', with: 'Stretching and breathing' | ||
| fill_in 'workshop_idea_time_warm_up', with: 5 | ||
| fill_in 'workshop_idea_creation', with: 'Hands-on creation' | ||
| fill_in 'workshop_idea_time_creation', with: 30 | ||
| fill_in 'workshop_idea_closing', with: 'Reflection and clean up' | ||
| fill_in 'workshop_idea_time_closing', with: 10 | ||
| fill_in 'workshop_idea_notes', with: 'Some notes' | ||
| fill_in 'workshop_idea_tips', with: 'Some tips' | ||
| attach_file('workshop_primary_media', Rails.root.join('spec/fixtures/some_file.png')) if page.has_field?('workshop_idea_primary_asset_attributes_file') | ||
| # Submit | ||
| click_button 'Submit' | ||
| expect(page).to have_content('Workshop idea was successfully created') | ||
| end | ||
|
|
||
| it "cancels the form when clicking Cancel" do | ||
| fill_in 'workshop_idea_title', with: 'My unsubmitted Workshop' | ||
| select 'ADULT WINDOWS', from: 'workshop_idea_windows_type_id' | ||
| # select 'Adult', from:'workshop_idea_age_range' | ||
| fill_in 'workshop_idea_objective', with: 'Learn nothing new' | ||
| fill_in 'workshop_idea_description', with: 'This is a test workshop description.' | ||
| fill_in 'workshop_idea_materials', with: 'Paper, markers' | ||
| fill_in 'workshop_idea_optional_materials', with: 'Scissors, glue' | ||
| fill_in 'workshop_idea_setup', with: 'Arrange tables' | ||
| fill_in 'workshop_idea_introduction', with: 'Start with a story' | ||
| fill_in 'workshop_idea_time_intro', with: 10 | ||
| fill_in 'workshop_idea_opening_circle', with: 'Welcome and warm up' | ||
| fill_in 'workshop_idea_time_opening_circle', with: 5 | ||
| fill_in 'workshop_idea_demonstration', with: 'Show how it works' | ||
| fill_in 'workshop_idea_time_demonstration', with: 15 | ||
| fill_in 'workshop_idea_warm_up', with: 'Stretching and breathing' | ||
| fill_in 'workshop_idea_time_warm_up', with: 5 | ||
| fill_in 'workshop_idea_creation', with: 'Hands-on creation' | ||
| fill_in 'workshop_idea_time_creation', with: 30 | ||
| fill_in 'workshop_idea_closing', with: 'Reflection and clean up' | ||
| fill_in 'workshop_idea_time_closing', with: 10 | ||
| fill_in 'workshop_idea_notes', with: 'Some notes' | ||
| fill_in 'workshop_idea_tips', with: 'Some tips' | ||
| attach_file('workshop_primary_media', Rails.root.join('spec/fixtures/some_file.png')) if page.has_field?('workshop_idea_primary_asset_attributes_file') | ||
| # Cancel | ||
| click_link 'Cancel' | ||
| expect(page).to have_content('Featured Workshops') | ||
| expect(page).to have_content('Community News') | ||
| end | ||
| end | ||
| end | ||
| end | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diti0-dot we used to have to do this bc of a callback dependency, but we've removed that, so your tests should still pass even if you remove these create(:windows_type) statements