VRFS-2823 : Update test for changed items and add a test for switching the filter via URL.

This commit is contained in:
Steven Miers 2015-03-15 19:45:37 -05:00
parent 9a38b63376
commit 05d029243d
1 changed files with 21 additions and 16 deletions

View File

@ -3,10 +3,10 @@ require 'spec_helper'
describe "JamTrack Shopping", :js => true, :type => :feature, :capybara_feature => true do
let(:user) { FactoryGirl.create(:user) }
let(:jt_us) { FactoryGirl.create(:jam_track, :name=>'jt_us', sales_region: 'United States', make_track: true) }
let(:jt_ww) { FactoryGirl.create(:jam_track, :name=>'jt_ww', sales_region: 'Worldwide', make_track: true) }
let(:jt_rock) { FactoryGirl.create(:jam_track, :name=>'jt_rock', genre: JamRuby::Genre.find('rock'), make_track: true) }
let(:jt_blues) { FactoryGirl.create(:jam_track, :name=>'jt_blues', genre: JamRuby::Genre.find('blues'), make_track: true) }
let(:jt_us) { FactoryGirl.create(:jam_track, :name=>'jt_us', sales_region: 'United States', make_track: true, original_artist: "foobar") }
let(:jt_ww) { FactoryGirl.create(:jam_track, :name=>'jt_ww', sales_region: 'Worldwide', make_track: true, original_artist: "barfoo") }
let(:jt_rock) { FactoryGirl.create(:jam_track, :name=>'jt_rock', genre: JamRuby::Genre.find('rock'), make_track: true, original_artist: "badfood") }
let(:jt_blues) { FactoryGirl.create(:jam_track, :name=>'jt_blues', genre: JamRuby::Genre.find('blues'), make_track: true, original_artist: "foodbart") }
before(:all) do
Capybara.javascript_driver = :poltergeist
@ -35,11 +35,11 @@ describe "JamTrack Shopping", :js => true, :type => :feature, :capybara_feature
def find_jamtrack jamtrack, options = {}
jamtrack_record = find(".jamtrack-record[jamtrack-id=\"#{jamtrack.id}\"]")
jamtrack_record.find('.detail-value', text: jamtrack.name)
jamtrack_record.find('.detail-value', text: jamtrack.recording_type)
#jamtrack_record.find('.detail-value', text: jamtrack.recording_type)
jamtrack_record.find('.detail-value', text: jamtrack.original_artist)
jamtrack_record.find('.detail-value', text: jamtrack.genre.description)
jamtrack_record.find('.detail-value', text: [jamtrack.songwriter, jamtrack.publisher].join(', '))
jamtrack_record.find('.copyright-value', text: jamtrack.licensor.name)
# jamtrack_record.find('.detail-value', text: jamtrack.genre.description)
# jamtrack_record.find('.detail-value', text: [jamtrack.songwriter, jamtrack.publisher].join(', '))
# jamtrack_record.find('.copyright-value', text: jamtrack.licensor.name)
jamtrack_record.find('.jamtrack-price', text: "$ #{jamtrack.price}")
if jamtrack.sales_region == 'United States'
@ -67,8 +67,7 @@ describe "JamTrack Shopping", :js => true, :type => :feature, :capybara_feature
before(:each) do
visit "/client#/jamtrack"
find('h1', text: 'jamtracks')
find('a', text: 'What is a JamTrack?')
find('h1', text: 'jamtracks')
jk_select('Any', '#jamtrack-find-form #jamtrack_availability')
end
@ -86,11 +85,11 @@ describe "JamTrack Shopping", :js => true, :type => :feature, :capybara_feature
not_find_jamtrack jt_rock
end
it "filters with genre" do
jk_select('Blues', '#jamtrack-find-form #jamtrack_genre')
find_jamtrack jt_blues
it "filters with artist" do
jk_select("foobar", '#jamtrack-find-form #jamtrack_artist')
find_jamtrack jt_us
not_find_jamtrack jt_blues
not_find_jamtrack jt_rock
not_find_jamtrack jt_us
not_find_jamtrack jt_ww
end
@ -103,12 +102,18 @@ describe "JamTrack Shopping", :js => true, :type => :feature, :capybara_feature
end
it "sets artist filter" do
pending "The item is clearly present, so not currently sure why capybar can't find it"
visit "/client?artist=foobar#/jamtrack"
art = find('#jamtrack_artist')
puts "art: #{art}"
end
describe "Shopping Carts" do
before(:each) do
visit "/client#/jamtrack"
find('h1', text: 'jamtracks')
find('a', text: 'What is a JamTrack?')
find('h1', text: 'jamtracks')
jk_select('Any', '#jamtrack-find-form #jamtrack_availability')
end