123 lines
3.0 KiB
Ruby
123 lines
3.0 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe "Product Pages", :js => true, :type => :feature, :capybara_feature => true do
|
|
|
|
subject { page }
|
|
|
|
before(:all) do
|
|
ShoppingCart.delete_all
|
|
JamTrackRight.delete_all
|
|
JamTrack.delete_all
|
|
JamTrackTrack.delete_all
|
|
JamTrackLicensor.delete_all
|
|
end
|
|
|
|
let(:user) { FactoryGirl.create(:user) }
|
|
let(:jamtrack_acdc_backinblack) { @jamtrack_acdc_backinblack }
|
|
|
|
let(:billing_info) {
|
|
{
|
|
first_name: 'Seth',
|
|
last_name: 'Call',
|
|
address1: '10704 Buckthorn Drive',
|
|
city: 'Austin',
|
|
state: 'Texas',
|
|
country: 'US',
|
|
zip: '78759',
|
|
number: '4111111111111111',
|
|
month: '08',
|
|
year: '2017',
|
|
verification_value: '012'
|
|
}
|
|
}
|
|
|
|
def create_account(user, billing_info)
|
|
@recurlyClient.create_account(user, billing_info)
|
|
@created_accounts << user
|
|
end
|
|
|
|
|
|
before(:all) do
|
|
|
|
@recurlyClient = RecurlyClient.new
|
|
@created_accounts = []
|
|
|
|
@jamtrack_acdc_backinblack = FactoryGirl.create(:jam_track, name: 'Back in Black', original_artist: 'AC/DC', sales_region: 'United States', make_track: true, plan_code: 'jamtrack-acdc-backinblack')
|
|
|
|
# make sure plans are there
|
|
@recurlyClient.create_jam_track_plan(@jamtrack_acdc_backinblack) unless @recurlyClient.find_jam_track_plan(@jamtrack_acdc_backinblack)
|
|
end
|
|
|
|
|
|
after(:each) do
|
|
@created_accounts.each do |user|
|
|
if user.recurly_code
|
|
begin
|
|
@account = Recurly::Account.find(user.recurly_code)
|
|
if @account.present?
|
|
@account.destroy
|
|
end
|
|
rescue
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
describe "JamBlaster" do
|
|
it "logged out" do
|
|
visit "/products/jamblaster"
|
|
|
|
find('h1', text: 'The JamBlaster by JamKazam')
|
|
find('a.white-bordered-button')['href'].should eq("#") # nowhere to go yet
|
|
end
|
|
|
|
it "logged in" do
|
|
fast_signin(user, "/products/jamblaster")
|
|
|
|
find('h1', text: 'The JamBlaster by JamKazam')
|
|
find('a.white-bordered-button')['href'].should eq("#") # nowhere to go yet
|
|
end
|
|
end
|
|
|
|
describe "Platform" do
|
|
it "logged out" do
|
|
visit "/products/platform"
|
|
|
|
find('h1', text: 'The JamKazam Platform')
|
|
find('a.white-bordered-button').trigger(:click)
|
|
|
|
find('h2', text: 'Create your free JamKazam account')
|
|
end
|
|
|
|
it "logged in" do
|
|
fast_signin(user, "/products/platform")
|
|
|
|
find('h1', text: 'The JamKazam Platform')
|
|
find('a.white-bordered-button').trigger(:click)
|
|
|
|
# clicking /signup just redirects you to the client
|
|
find('h2', text: 'create session')
|
|
end
|
|
end
|
|
|
|
describe "JamTracks" do
|
|
it "logged out" do
|
|
visit "/products/jamtracks"
|
|
|
|
find('h1', text: 'JamTracks by JamKazam')
|
|
find('a.white-bordered-button').trigger(:click)
|
|
|
|
find('h1', text: 'jamtracks')
|
|
end
|
|
|
|
it "logged in" do
|
|
fast_signin(user, "/products/jamtracks")
|
|
|
|
find('h1', text: 'JamTracks by JamKazam')
|
|
find('a.white-bordered-button').trigger(:click)
|
|
|
|
find('h1', text: 'jamtracks')
|
|
end
|
|
end
|
|
end
|