-
-
Save micmmakarov/5437475 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 'spec_helper' | |
require 'pry' | |
require 'pry-nav' | |
include Warden::Test::Helpers | |
feature 'Propack Order', :js => true do | |
background do | |
user = Factory.create(:user) | |
login_as(user, :scope => :user) | |
cc = [] | |
cc << FactoryGirl.create(:course_category, :name => "Healthcare Professionals", :display_order => 0, :search => 1) | |
cc << FactoryGirl.create(:course_category, :name => "ACLS - Advanced Cardiovascular Life Support", :display_order => 1, :search => 0) | |
cc << FactoryGirl.create(:course_category, :name => "BLS - Basic Life Support", :display_order => 2, :search => 0) | |
cc << FactoryGirl.create(:course_category, :name => "PALS - Pediatric Advanced Life Support", :display_order => 3, :search => 0) | |
c = FactoryGirl.create(:course, :name => "HeartCode® ACLS Part 1", :product_number => "90-1405", :description => "HeartCode® ACLS Part 1", :expected_hours => 10) | |
c.course_categories << cc[0] | |
c.course_categories << cc[1] | |
c.save! | |
c = FactoryGirl.create(:course, :name => "Learn:® Rapid STEMI ID", :product_number => "90-1415", :description => "Learn:® Rapid STEMI ID", :expected_hours => 5) | |
c.course_categories << cc[0] | |
c.course_categories << cc[1] | |
c.save! | |
fs = Spree::PaymentMethod.create(:name => "FastSpring", :active => true, :environment => "development" ) | |
fs.type = "PaymentMethod::Fastspring" | |
fs.save! | |
bg = Spree::PaymentMethod.create(:name => "Bogus", :active => true, :environment => "development" ) | |
bg.type = "Spree::Gateway::Bogus" | |
bg.save! | |
Spree::Preference.create(:value => "scitent", :key => "payment_method/fastspring/company/1", :value_type => "string" ) | |
Spree::Preference.create(:value => "phoenix", :key => "payment_method/fastspring/username/1", :value_type => "string" ) | |
Spree::Preference.create(:value => "demo", :key => "payment_method/fastspring/password/1", :value_type => "string" ) | |
binding.pry | |
FactoryGirl.definition_file_paths << (Scidea.root.join "spec/factories") | |
FactoryGirl.create(:enrollment_package, :allows_purchase => true, :price => 15) | |
a = Scidea::EnrollmentPackage.create(allows_purchase:true, price:15) | |
FactoryGirl.create(:enrollment_package, :allows_purchase => true, :price => 15) | |
end | |
scenario "Create a propack order" do | |
#Spree::State.create(name:'North Dakota',country_id:1) | |
#Spree::Country.create(name:'United States') | |
visit new_propack_orders_path | |
page.html.should have_content("Order Propack") | |
fill_in 'propack_order_email', :with => 'user@dfkjsjdsajk.com' | |
fill_in 'propack_order_phone', :with => '1234567890' | |
fill_in 'propack_order_account_manager', :with => 'John Smith' | |
#company | |
fill_in 'propack_order_company_name', :with => 'Green Tables and Sea Horses International' | |
fill_in 'propack_order_company_contact', :with => 'Billie Joe Obama' | |
fill_in 'propack_order_company_street_address', :with => '1234 Green Bush First Second Street' | |
fill_in 'propack_order_company_city', :with => 'Asheville' | |
fill_in 'propack_order_company_phone', :with => '555-555-55555' | |
fill_in 'propack_order_admin_email', :with => 'the_admin@dsfsdfasdfds.com' | |
fill_in 'propack_order_company_country_id', :with => 1 | |
fill_in 'propack_order_company_state_id', :with => 'a' | |
fill_in 'propack_order_company_postal_code', :with => '12345' | |
# Submit button should be disabled if not agree with the terms | |
page.should have_css("input.submit[disabled]") | |
page.execute_script("$('#agreement').attr('checked', 'checked')") | |
page.execute_script("$('#agreement').trigger('change')") | |
page.should have_no_css("input.submit[disabled]") | |
page.execute_script("$('.submit').trigger('click')") | |
binding.pry | |
#page.find(:css, "#agreement").set(true) | |
#page.find("input[name='commit']").should have_text("Submit") | |
#page.driver.render("image.png", :full => true) | |
#binding.pry | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment