style updates / only allow 1 genre now

This commit is contained in:
Brian Smith 2013-02-05 02:58:19 -05:00
parent 80f3e792d6
commit f979c35faf
10 changed files with 278 additions and 173 deletions

View File

@ -10,7 +10,7 @@
var autoComplete = null;
var userNames = [];
var userIds = [];
var MAX_GENRES = 3;
var MAX_GENRES = 1;
// for unit tests
function loadGenres() {
@ -29,33 +29,39 @@
}
function afterShow(data) {
$.ajax({
type: "GET",
url: "/api/users/" + context.JK.currentUserId + "/friends",
async: false
}).done(function(response) {
$.each(response, function() {
userNames.push(this.first_name + ' ' + this.last_name);
userIds.push(this.id);
});
// Hook up the autocomplete.
var autoCompleteOptions = {
lookup: { suggestions: userNames, data: userIds },
onSelect: addInvitation
};
if (!autoComplete) {
autoComplete = $('#friend-input').autocomplete(autoCompleteOptions);
} else {
autoComplete.setOptions(autoCompleteOptions);
}
$.ajax({
type: "GET",
url: "/api/users/" + context.JK.currentUserId + "/friends",
async: false
}).done(function(response) {
$.each(response, function() {
userNames.push(this.first_name + ' ' + this.last_name);
userIds.push(this.id);
});
// Hook up the autocomplete.
var autoCompleteOptions = {
lookup: { suggestions: userNames, data: userIds },
onSelect: addInvitation
};
if (!autoComplete) {
autoComplete = $('#friend-input').autocomplete(autoCompleteOptions);
} else {
autoComplete.setOptions(autoCompleteOptions);
}
});
}
function addInvitation(value, data) {
var template = $('#template-added-invitation').html();
var invitationHtml = context.JK.fillTemplate(template, {userId: data, userName: value});
$('#selected-friends').append(invitationHtml);
$('#friend-input').select();
if ($('#selected-friends div[user-id=' + data + ']').length == 0) {
var template = $('#template-added-invitation').html();
var invitationHtml = context.JK.fillTemplate(template, {userId: data, userName: value});
$('#selected-friends').append(invitationHtml);
$('#friend-input').select();
}
else {
$('#friend-input').select();
alert('Invitation already exists for this musician.');
}
}
function removeInvitation(evt) {
@ -81,11 +87,11 @@
var genres = genreSelector.getSelectedGenres();
if (genres.length == 0) {
errors.push(['#genre-list-items', "Please select a genre."]);
errors.push(['#genre-list', "Please select a genre."]);
}
if (genres.length > MAX_GENRES) {
errors.push(['#genre-list-items', "No more than " + MAX_GENRES + "genres are allowed."]);
errors.push(['#genre-list', "No more than " + MAX_GENRES + "genres are allowed."]);
}
return (errors.length) ? errors : null;
@ -240,7 +246,6 @@
}
function searchFriends(query) {
alert(query);
if (query.length < 2) {
$('#friend-search-results').empty();
return;

View File

@ -24,86 +24,90 @@
}
function reset() {
$('#genre-list-items input[type=checkbox]', _form).removeAttr('checked');
$('#genre-list-items input[type=checkbox]', _form).removeAttr('disabled');
$('#genre-count', _form).val('0');
$('genre-list', _form).val('');
//$('#genre-list-items input[type=checkbox]', _form).removeAttr('checked');
//$('#genre-list-items input[type=checkbox]', _form).removeAttr('disabled');
//$('#genre-count', _form).val('0');
}
function genresLoaded(response) {
$.each(response, function(index) {
var template = $('#template-genre-option', _form).html();
var genreOptionHtml = context.JK.fillTemplate(template, {value: this.id, label: this.description});
$('#genre-list-items', _form).append(genreOptionHtml);
//$('#genre-list-items', _form).append(genreOptionHtml);
$('#genre-list', _form).append(genreOptionHtml);
});
}
function toggleGenreBox() {
var boxHeight = $('#genre-list', _form).css("height");
// TODO: clean this up (check class name of arrow to determine current state)
if (boxHeight == "20px") {
$('#genre-list', _form).css({height: "auto"});
$('#genre-list-arrow', _form).removeClass("arrow-down").addClass("arrow-up");
// function toggleGenreBox() {
// var boxHeight = $('#genre-list', _form).css("height");
// // TODO: clean this up (check class name of arrow to determine current state)
// if (boxHeight == "20px") {
// $('#genre-list', _form).css({height: "auto"});
// $('#genre-list-arrow', _form).removeClass("arrow-down").addClass("arrow-up");
}
else {
$('#genre-list', _form).css({height: "20px"});
$('#genre-list-arrow', _form).removeClass("arrow-up").addClass("arrow-down");
}
}
// }
// else {
// $('#genre-list', _form).css({height: "20px"});
// $('#genre-list-arrow', _form).removeClass("arrow-up").addClass("arrow-down");
// }
// }
// Used to disable checkboxes once _maxSelections are selected.
function updateGenreCount() {
var genreCount = parseInt($('#genre-count', _form).val());
if ($(this).attr('checked')) {
genreCount++;
}
else {
genreCount--;
}
// function updateGenreCount() {
// var genreCount = parseInt($('#genre-count', _form).val());
// if ($(this).attr('checked')) {
// genreCount++;
// }
// else {
// genreCount--;
// }
$('#genre-count', _form).val(genreCount);
// $('#genre-count', _form).val(genreCount);
var disabled = false;
if (_maxSelections != 0 && genreCount == _maxSelections) {
disabled = true;
}
// var disabled = false;
// if (_maxSelections != 0 && genreCount == _maxSelections) {
// disabled = true;
// }
$('#genre-list-items input[type=checkbox]', _form).each(function() {
if (!$(this).attr('checked')) {
if (disabled) {
$(this).attr('disabled', 'disabled');
}
else {
$(this).removeAttr('disabled');
}
}
});
}
// $('#genre-list-items input[type=checkbox]', _form).each(function() {
// if (!$(this).attr('checked')) {
// if (disabled) {
// $(this).attr('disabled', 'disabled');
// }
// else {
// $(this).removeAttr('disabled');
// }
// }
// });
// }
function getSelectedGenres() {
var selectedGenres = [];
$('#genre-list-items :checked', _form).each(function() {
selectedGenres.push($(this).val());
});
// $('#genre-list-items :checked', _form).each(function() {
// selectedGenres.push($(this).val());
// });
selectedGenres.push($('genre-list', _form).val());
return selectedGenres;
}
function events() {
$('#genre-list-header', _form).on("click", toggleGenreBox);
$('#genre-list-arrow', _form).on("click", toggleGenreBox);
$('#genre-list-items input[type=checkbox]', _form).each(function() {
$(this).on("click", updateGenreCount);
});
// $('#genre-list-header', _form).on("click", toggleGenreBox);
// $('#genre-list-arrow', _form).on("click", toggleGenreBox);
// $('#genre-list-items input[type=checkbox]', _form).each(function() {
// $(this).on("click", updateGenreCount);
// });
}
function initialize(title, maxSelections, form) {
_form = form;
_maxSelections = maxSelections;
$('#genre-list-header', _form).text(title);
// $('#genre-list-header', _form).text(title);
loadGenres();
events();
// events();
};
this.initialize = initialize;

View File

@ -19,6 +19,10 @@
height:80px;
}
.input-title {
padding-bottom:5px;
}
.friendbox {
padding:5px;
height:60px;

View File

@ -59,6 +59,10 @@ a.arrow-down {
border-top: 7px solid #333;
}
select {
font-size:12px;
}
form .body {
/* TODO - size with layout */
width: 100%;
@ -169,23 +173,34 @@ input[type="button"] {
/* Autocomplete */
.autocomplete {
border:1px solid #999;
background:$ColorElementPrimary;
background:$ColorScreenBackground;
color:$ColorText;
cursor:default;
text-align:left;
max-height:350px;
overflow:auto;
margin:-6px 6px 6px -6px;
/* IE6 specific: */ _height:350px;
_height:350px; /* IE6 specific: */
_margin:0;
_overflow-x:hidden;
}
.autocomplete .selected { background:#F0F0F0; }
.autocomplete .selected {
background:$ColorScreenBackground;
cursor:pointer;
}
.autocomplete div { padding:2px 5px; white-space:nowrap; overflow:hidden; }
.autocomplete div {
padding:10px 10px 10px 10px;
white-space:nowrap;
overflow:hidden;
border:1px solid #999;
text-align:center;
}
.autocomplete strong { font-weight:normal; color:#3399FF; }
.autocomplete strong {
font-weight:normal;
}
.multiselect-dropdown {
position:relative;

View File

@ -265,6 +265,10 @@ a img {
margin-right:35px;
}
.ml5 {
margin-left:5px;
}
.ml10 {
margin-left:10px;
}
@ -281,6 +285,18 @@ a img {
margin-left:35px;
}
.mt5 {
margin-top:5px;
}
.mt35 {
margin-top:35px;
}
.mb15 {
margin-bottom:15px;
}
.op50 {
opacity: .5;
-ms-filter: "alpha(opacity=50)";

View File

@ -14,79 +14,130 @@
<div class="content-scroller">
<div class="content-wrapper">
<!-- left column -->
<div class="session-left">
<div class="session-left">
<h2>session info</h2>
<br />
Description:<br />
<textarea rows=4 id="description" name="description" class="session-description"></textarea>
<br />
<br />
<div class="left mr20">
Genre:<br />
<%= render "genreSelector" %>
<div class="input-title">Band:</div>
<div>
<select id="band-list">
<option value="">Not a Band Session</option>
</select>
</div>
</div>
<div class="left">
Band:<br />
<select id="band-list">
<option value="">Not a Band Session</option>
</select>
<div class="input-title">Genre:</div>
<div><%= render "genreSelector" %></div>
</div>
<br clear="all" /><br />
<div>
<div class="input-title">Description:</div>
<div>
<textarea rows=4 id="description" name="description" class="session-description"></textarea>
</div>
</div>
<br clear="all" />
<br />
Musician Access:<br />
<select id="musician-access" class="left mr20">
<option selected="selected" value="true">Public</option>
<option value="false">Private</option>
</select>
<div class="left">
<input type="radio" name="musician-access-option" checked="checked" value="false" />&nbsp;Open&nbsp;&nbsp;
<input type="radio" name="musician-access-option" value="true" />&nbsp;By Approval
<div class="input-title">Musician Access:</div>
<div>
<div>
<select id="musician-access" class="left mr20">
<option selected="selected" value="true">Public</option>
<option value="false">Private</option>
</select>
</div>
<div class="left">
<input type="radio" name="musician-access-option" checked="checked" value="false" />&nbsp;Open&nbsp;&nbsp;
<input type="radio" name="musician-access-option" value="true" />&nbsp;By Approval
</div>
</div>
<br clear="all" /><br />
Fan Access:<br />
<select id="fan-access" class="left mr20">
<option value="true">Public</option>
<option selected="selected" value="false">Private</option>
</select>
<div class="left op50">
<input type="radio" name="fan-chat-option" value="true" disabled="disabled" />&nbsp;Chat&nbsp;&nbsp;
<input type="radio" name="fan-chat-option" checked="checked" value="false" disabled="disabled" />&nbsp;No Fan Chat
<div class="input-title">Fan Access:</div>
<div>
<div>
<select id="fan-access" class="left mr20">
<option value="true">Public</option>
<option selected="selected" value="false">Private</option>
</select>
</div>
<div class="left op50">
<input type="radio" name="fan-chat-option" value="true" disabled="disabled" />&nbsp;Chat&nbsp;&nbsp;
<input type="radio" name="fan-chat-option" checked="checked" value="false" disabled="disabled" />&nbsp;No Fan Chat
</div>
</div>
</div>
<!-- right column -->
<div class="session-right">
<h2>invite musicians</h2>
<br />
Start typing:<br /> <!-- or: <input type="button" value="CHOOSE FRIENDS" /><br /> -->
<div style="width:78%;">
<div class="left" style="margin-top:10px;">
Start typing friends' names:
</div>
<div class="right">
<a href="#" id="btn-choose-friends" class="button-grey">CHOOSE FRIENDS</a>
</div>
</div>
<div class="clearall" />
<br />
<!-- friend invitation box -->
<div class="friendbox">
<div id="selected-friends"></div>
<input id="friend-input" type="text" value="Type a friend's name" />
</div>
<br />
Invite friends and contacts to join you on JamKazam from:<br /><br />
<div class="left mr20">
<%= image_tag("content/icon_facebook.png", :size => "24x24", :align => "absmiddle") %>&nbsp;&nbsp;Facebook
<div class="mt35 mb15">
Invite friends and contacts to join you on JamKazam from:
</div>
<div class="left mr20">
<%= image_tag("content/icon_twitter.png", :size => "24x24", :align => "absmiddle") %>&nbsp;&nbsp;Twitter
</div>
<div class="left">
<%= image_tag("content/icon_gmail.png", :size => "24x24", :align => "absmiddle") %>&nbsp;&nbsp;E-mail
<div>
<div class="left mr20">
<div class="left">
<%= image_tag("content/icon_facebook.png", :size => "24x24", :align => "absmiddle") %>
</div>
<div class="right mt5 ml5">Facebook</div>
</div>
<div class="left mr20">
<div class="left">
<%= image_tag("content/icon_twitter.png", :size => "24x24", :align => "absmiddle") %>
</div>
<div class="right mt5 ml5">Twitter</div>
</div>
<div class="left mr20">
<div class="left">
<%= image_tag("content/icon_google.png", :size => "24x24", :align => "absmiddle") %>
</div>
<div class="right mt5 ml5">Google+</div>
</div>
<div class="left">
<div class="left">
<%= image_tag("content/icon_gmail.png", :size => "24x24", :align => "absmiddle") %>
</div>
<div class="right mt5 ml5">E-mail</div>
</div>
</div>
<br clear="all" />
<br />
<!-- terms -->
<div class="terms-checkbox">
<input type="checkbox" />
</div>
<div class="terms">
I agree that intellectual property ownership of any musical works created during this session shall be governed by the terms of the Creative Commons CC BY-NC-SA license in accordance with the JamKazam Terms of Service.
<div style="margin-top:40px;">
<div class="terms-checkbox">
<input type="checkbox" />
</div>
<div class="terms">
I agree that intellectual property ownership of any musical works created during this session shall be governed by the terms of the Creative Commons CC BY-NC-SA license in accordance with the JamKazam Terms of Service.
</div>
</div>
</div>
<br clear="all" />

View File

@ -1,4 +1,7 @@
<div id="genre-list" class="multiselect-dropdown">
<select id="genre-list">
<option value="">Select Genre</option>
</select>
<!--<div id="genre-list" class="multiselect-dropdown">
<div class="list-item-text">
<a id="genre-list-header"></a>
</div>
@ -8,7 +11,13 @@
<input id="genre-count" type="hidden" value="0" />
</div>
<!-- Genre option template -->
<!-- Genre option template
<script type="text/template" id="template-genre-option">
<div class="list-item-text"><input type="checkbox" value="{value}"> {label}</div>
</script>
-->
<!-- Genre option template -->
<script type="text/template" id="template-genre-option">
<option value="{value}">{label}</option>
</script>

View File

@ -13,13 +13,14 @@
var selectors = {
form: '#create-session-form',
genres: '#genre-list-items',
genres: '#genre-list',
description: '#description'
};
function makeValid() {
var genre = '<div class="list-item-text"><input type="checkbox" checked="checked" value="1">1</div>';
$(selectors.genres, $(selectors.form)).append(genre);
//var genre = '<div class="list-item-text"><input type="checkbox" checked="checked" value="1">1</div>';
$(selectors.genres).val('african');
//$(selectors.genres, $(selectors.form)).append(genre);
$(selectors.description).val('XYZ');
}
@ -48,7 +49,7 @@
});
it("should populate genres select", function() {
css.loadGenres();
expect($(selectors.genres + ' .list-item-text', $(selectors.form).length).toEqual(2);
expect($(selectors.genres, $(selectors.form).length).toEqual(2);
});
});
@ -121,20 +122,20 @@
expect(errs).toBeNull();
});
it("should fail with > 3 genres", function() {
var htm = '<div class="list-item-text"><input type="checkbox" checked="checked" value="2">2</div>' +
'<div class="list-item-text"><input type="checkbox" checked="checked" value="3">3</div>' +
'<div class="list-item-text"><input type="checkbox" checked="checked" value="4">4</div>' +
'<div class="list-item-text"><input type="checkbox" checked="checked" value="5">5</div>';
$(selectors.genres, $(selectors.form)).append(htm);
var errs = css.validateForm();
// Verify that we have an error.
expect(errs).toBeTruthy();
// Verify that the error is a two-part list
expect(errs[0].length).toEqual(2);
// Verify that the first part is a selector for the problem.
expect(errs[0][0]).toEqual('#genre-list-items');
});
// it("should fail with > 3 genres", function() {
// var htm = '<div class="list-item-text"><input type="checkbox" checked="checked" value="2">2</div>' +
// '<div class="list-item-text"><input type="checkbox" checked="checked" value="3">3</div>' +
// '<div class="list-item-text"><input type="checkbox" checked="checked" value="4">4</div>' +
// '<div class="list-item-text"><input type="checkbox" checked="checked" value="5">5</div>';
// $(selectors.genres, $(selectors.form)).append(htm);
// var errs = css.validateForm();
// // Verify that we have an error.
// expect(errs).toBeTruthy();
// // Verify that the error is a two-part list
// expect(errs[0].length).toEqual(2);
// // Verify that the first part is a selector for the problem.
// expect(errs[0][0]).toEqual('#genre-list-items');
// });
it("should fail with 0 genres", function() {
$(selectors.genres, $(selectors.form)).html('');
@ -142,7 +143,7 @@
// Verify that we have an error.
expect(errs).toBeTruthy();
// Verify that the first part is a selector for the problem.
expect(errs[0][0]).toEqual('#genre-list-items');
expect(errs[0][0]).toEqual('#genre-list');
});
it("should fail with empty description", function() {

View File

@ -100,7 +100,7 @@ describe "Band API", :type => :api do
it "should allow band creation" do
last_response = create_band(user, "My Band", "http://www.myband.com", "Bio", "Apex", "NC", "USA", ["african", "hip hop", "country"], "www.photos.com", "www.logos.com")
last_response = create_band(user, "My Band", "http://www.myband.com", "Bio", "Apex", "NC", "USA", ["country"], "www.photos.com", "www.logos.com")
last_response.status.should == 201
new_band = JSON.parse(last_response.body)
@ -113,7 +113,7 @@ describe "Band API", :type => :api do
band_details = JSON.parse(last_response.body)
band_details["id"].should == new_band["id"]
band_details["musicians"][0]["id"].should == user.id
band_details["genres"].size.should == 3
band_details["genres"].size.should == 1
end
it "should prevent bands with less than 1 genre" do
@ -123,8 +123,8 @@ describe "Band API", :type => :api do
error_msg["message"].should == ValidationMessages::GENRE_MINIMUM_NOT_MET
end
it "should prevent bands with more than 3 genres" do
last_response = create_band(user, "My Band", "http://www.myband.com", "Bio", "Apex", "NC", "USA", ["african", "hip hop", "country", "reggae"], "www.photos.com", "www.logos.com")
it "should prevent bands with more than 1 genre" do
last_response = create_band(user, "My Band", "http://www.myband.com", "Bio", "Apex", "NC", "USA", ["african", "country"], "www.photos.com", "www.logos.com")
last_response.status.should == 400
error_msg = JSON.parse(last_response.body)
error_msg["message"].should == ValidationMessages::GENRE_LIMIT_EXCEEDED
@ -136,16 +136,16 @@ describe "Band API", :type => :api do
before(:each) do
login(user.email, user.password, 200, true)
band.genres << Genre.find("hip hop")
band.genres << Genre.find("african")
band.genres << Genre.find("country")
#band.genres << Genre.find("african")
#band.genres << Genre.find("country")
user.bands << band
end
it "should allow user to update attributes of band A" do
band.genres.size.should == 3
band.genres.size.should == 1
last_response = update_band(user, band.id, "Brian's Band", "http://www.briansband.com", "Bio", "Apex", "NC", "USA", ["african", "blues"], "www.photos.com", "www.logos.com")
last_response = update_band(user, band.id, "Brian's Band", "http://www.briansband.com", "Bio", "Apex", "NC", "USA", ["african"], "www.photos.com", "www.logos.com")
last_response.status.should == 200
updated_band = JSON.parse(last_response.body)
@ -153,7 +153,7 @@ describe "Band API", :type => :api do
# spot check fields in response entity
updated_band["name"].should == "Brian's Band"
updated_band["website"].should == "http://www.briansband.com"
updated_band["genres"].size.should == 2
updated_band["genres"].size.should == 1
# retrieve the band to get details
last_response = get_band(user, band.id)
@ -162,7 +162,7 @@ describe "Band API", :type => :api do
band_details["name"].should == "Brian's Band"
band_details["website"].should == "http://www.briansband.com"
band_details["biography"].should == "Bio"
band_details["genres"].size.should == 2
band_details["genres"].size.should == 1
end
it "should allow user to create recording for band A" do
@ -282,8 +282,8 @@ describe "Band API", :type => :api do
before(:each) do
login(user.email, user.password, 200, true)
band.genres << Genre.find("hip hop")
band.genres << Genre.find("african")
band.genres << Genre.find("country")
#band.genres << Genre.find("african")
#band.genres << Genre.find("country")
end
it "should not allow user to update attributes of band A" do

View File

@ -468,7 +468,7 @@ describe "User API", :type => :api do
it "should allow musician to create recordings" do
# create public recording
public_description = "My Public Recording"
last_response = create_user_recording(user, user, public_description, true, ["african", "hip hop", "country"])
last_response = create_user_recording(user, user, public_description, true, ["african"])
last_response.status.should == 201
recording = JSON.parse(last_response.body)
recording["description"].should == public_description
@ -486,7 +486,7 @@ describe "User API", :type => :api do
private_recording["genres"][0]["id"].should == "rock"
# update the second recording's description, public flag, and genre
last_response = update_user_recording(user, user, private_recording["id"], "My Recording 3", true, ["country", "hip hop"])
last_response = update_user_recording(user, user, private_recording["id"], "My Recording 3", true, ["country"])
last_response.status.should == 200
recording = JSON.parse(last_response.body)
recording["description"].should == "My Recording 3"
@ -498,23 +498,23 @@ describe "User API", :type => :api do
recording = JSON.parse(last_response.body)
recording["description"].should == "My Recording 3"
recording["public"].should == true
recording["genres"].size.should == 2
recording["genres"].size.should == 1
end
it "should not allow fan to create recordings" do
last_response = create_user_recording(fan, fan, "Fan Recording", true, ["african", "hip hop", "country"])
last_response = create_user_recording(fan, fan, "Fan Recording", true, ["african"])
last_response.status.should == 403
end
it "should allow creator to see public and private recordings in list" do
# create public recording
public_description = "My Public Recording"
last_response = create_user_recording(user, user, public_description, true, ["african", "hip hop", "country"])
last_response = create_user_recording(user, user, public_description, true, ["african"])
last_response.status.should == 201
# create private recording
private_description = "My Private Recording"
last_response = create_user_recording(user, user, private_description, false, ["african", "hip hop"])
last_response = create_user_recording(user, user, private_description, false, ["african"])
last_response.status.should == 201
# get all recordings as creator
@ -526,7 +526,7 @@ describe "User API", :type => :api do
it "should allow creator to see private recording details" do
# create private recording
private_description = "My Private Recording"
last_response = create_user_recording(user, user, private_description, false, ["african", "hip hop", "country"])
last_response = create_user_recording(user, user, private_description, false, ["african"])
last_response.status.should == 201
private_recording = JSON.parse(last_response.body)
private_recording["description"].should == private_description
@ -540,12 +540,12 @@ describe "User API", :type => :api do
it "should not allow non-creator to see private recordings in list" do
# create public recording
public_description = "My Public Recording"
last_response = create_user_recording(user, user, public_description, true, ["african", "hip hop", "country"])
last_response = create_user_recording(user, user, public_description, true, ["country"])
last_response.status.should == 201
# create private recording
private_description = "My Private Recording"
last_response = create_user_recording(user, user, private_description, false, ["african", "hip hop", "country"])
last_response = create_user_recording(user, user, private_description, false, ["country"])
last_response.status.should == 201
# get all recordings as non-creator
@ -561,7 +561,7 @@ describe "User API", :type => :api do
it "should not allow non-creator to see private recording details" do
# create private recording
private_description = "My Private Recording"
last_response = create_user_recording(user, user, private_description, false, ["african", "hip hop", "country"])
last_response = create_user_recording(user, user, private_description, false, ["country"])
last_response.status.should == 201
private_recording = JSON.parse(last_response.body)
private_recording["description"].should == private_description
@ -574,7 +574,7 @@ describe "User API", :type => :api do
it "should allow user to create favorites" do
# create recording first
last_response = create_user_recording(user, user, "My Recording", true, ["african", "hip hop", "country"])
last_response = create_user_recording(user, user, "My Recording", true, ["country"])
last_response.status.should == 201
recording = JSON.parse(last_response.body)
@ -600,7 +600,7 @@ describe "User API", :type => :api do
it "should not allow user to create favorite for another user" do
# create recording first
last_response = create_user_recording(user, user, "My Recording", true, ["african", "hip hop", "country"])
last_response = create_user_recording(user, user, "My Recording", true, ["country"])
last_response.status.should == 201
recording = JSON.parse(last_response.body)
@ -611,7 +611,7 @@ describe "User API", :type => :api do
it "should allow user to delete favorites" do
# create recording first
last_response = create_user_recording(user, user, "My Recording", true, ["african", "hip hop", "country"])
last_response = create_user_recording(user, user, "My Recording", true, ["country"])
last_response.status.should == 201
recording = JSON.parse(last_response.body)
@ -628,7 +628,7 @@ describe "User API", :type => :api do
it "should not allow user to delete another user's favorites" do
# create recording first
last_response = create_user_recording(user, user, "My Recording", true, ["african", "hip hop", "country"])
last_response = create_user_recording(user, user, "My Recording", true, ["country"])
last_response.status.should == 201
recording = JSON.parse(last_response.body)