Created
June 18, 2011 02:02
-
-
Save brandon-beacher/1032718 to your computer and use it in GitHub Desktop.
This file contains 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
require 'test_helper' | |
class InitialSuitTest < ActionDispatch::IntegrationTest | |
include Capybara::DSL | |
test "user should create a suit by uploading files" do | |
user = Factory(:user) | |
visit("/users/sign_in") | |
fill_in('Email', :with => user.email) | |
fill_in('Password', :with => user.password) | |
click_button('Log me in!') | |
click_link('New Case') | |
suit = Factory.attributes_for(:suit) | |
fill_in('Case Name', :with => suit[:title]) | |
click_button('Create Case') | |
click_link("I'll upload files from my computer") | |
click_link("Attach a file") | |
attach_file('attachment_file', "#{Rails.root}/README") | |
click_button('Add Attachment') | |
click_link("Attach another file") | |
attach_file('attachment_file', "#{Rails.root}/README") | |
click_button('Add Attachment') | |
click_button("I'm done attaching initial case files") | |
end | |
test "user should create a suit by entering the information directly and creating a new plaintiff's attorney" do | |
user = Factory(:user) | |
visit("/users/sign_in") | |
fill_in('Email', :with => user.email) | |
fill_in('Password', :with => user.password) | |
click_button('Log me in!') | |
click_link('New Case') | |
suit = Factory.attributes_for(:suit) | |
fill_in('Case Name', :with => suit[:title]) | |
click_button('Create Case') | |
click_link("I'll enter the information directly") | |
first_plaintiff = Factory.attributes_for(:plaintiff) | |
fill_in('party_first_name', :with => first_plaintiff[:first_name]) | |
fill_in('party_last_name', :with => first_plaintiff[:last_name]) | |
click_button('Add Plaintiff') | |
click_link('Add a new attorney') | |
first_attorney = Factory.attributes_for(:attorney) | |
fill_in('attorney_first_name', :with => first_attorney[:first_name]) | |
fill_in('attorney_last_name', :with => first_attorney[:last_name]) | |
click_button('Add Attorney') | |
click_link('Add another party') | |
defendant = Factory.attributes_for(:defendant) | |
fill_in('party_first_name', :with => defendant[:first_name]) | |
fill_in('party_last_name', :with => defendant[:last_name]) | |
choose('party_party_defendant') | |
click_button('Add Party') | |
click_link("I'm done adding parties") | |
click_link("Add a request") | |
request = Factory.attributes_for(:request) | |
fill_in('Business', :with => request[:business]) | |
click_button('Add Request') | |
click_link("Add another request") | |
request = Factory.attributes_for(:request) | |
fill_in('Business', :with => request[:business]) | |
click_button('Add Request') | |
click_button("I'm done adding requests") | |
end | |
test "user should create a suit by entering the information directly and choosing an existing plaintiff's attorney" do | |
user = Factory(:user) | |
visit("/users/sign_in") | |
fill_in('Email', :with => user.email) | |
fill_in('Password', :with => user.password) | |
click_button('Log me in!') | |
click_link('New Case') | |
suit = Factory.attributes_for(:suit) | |
fill_in('Case Name', :with => suit[:title]) | |
click_button('Create Case') | |
click_link("I'll enter the information directly") | |
# ensure that first_attorney is choosable by user | |
first_attorney = Factory(:attorney) | |
another_suit = Factory(:suit) | |
another_party = Factory(:party) | |
first_attorney.represent!(another_party, another_suit) | |
user.suits << another_suit | |
first_plaintiff = Factory.attributes_for(:plaintiff) | |
fill_in('party_first_name', :with => first_plaintiff[:first_name]) | |
fill_in('party_last_name', :with => first_plaintiff[:last_name]) | |
click_button('Add Plaintiff') | |
click_link(first_attorney.name) | |
click_button('Choose Attorney') | |
click_link('Add another party') | |
defendant = Factory.attributes_for(:defendant) | |
fill_in('party_first_name', :with => defendant[:first_name]) | |
fill_in('party_last_name', :with => defendant[:last_name]) | |
choose('party_party_defendant') | |
click_button('Add Party') | |
click_link("I'm done adding parties") | |
click_link("Add a request") | |
request = Factory.attributes_for(:request) | |
fill_in('Business', :with => request[:business]) | |
click_button('Add Request') | |
click_link("Add another request") | |
request = Factory.attributes_for(:request) | |
fill_in('Business', :with => request[:business]) | |
click_button('Add Request') | |
click_button("I'm done adding requests") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment