* show private recording on recording landing page to someone who was in the session
This commit is contained in:
parent
eb5c84c5bc
commit
28e752629a
|
|
@ -27,6 +27,10 @@ module JamRuby
|
|||
"#{base_url}/findSession"
|
||||
end
|
||||
|
||||
def self.session(session)
|
||||
"#{base_url}/session/#{session.id}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.base_url
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
<% end %>
|
||||
|
||||
<div class="recordings-page">
|
||||
<% if @claimed_recording.is_public %>
|
||||
<% if @claimed_recording.is_public || @claimed_recording.recording.has_access?(current_user) %>
|
||||
<div class="landing-band">
|
||||
<% unless @claimed_recording.recording.band.blank? %>
|
||||
<div class="landing-avatar">
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if @claimed_recording.is_public %>
|
||||
<% if @claimed_recording.is_public || @claimed_recording.recording.has_access?(current_user) %>
|
||||
<% if signed_in? %>
|
||||
<% unless @claimed_recording.recording.band.nil? %>
|
||||
<%= render :partial => "shared/landing_sidebar", :locals => {:user => @claimed_recording.recording.band, :recent_history => @claimed_recording.recording.band.recent_history} %>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "Landing", :js => true, :type => :feature, :capybara_feature => true do
|
||||
describe "Landing" do
|
||||
|
||||
let (:user) { FactoryGirl.create(:user) }
|
||||
|
||||
|
|
@ -10,41 +10,70 @@ describe "Landing", :js => true, :type => :feature, :capybara_feature => true do
|
|||
Recording.delete_all
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
MusicSession.delete_all
|
||||
sign_in_poltergeist(user)
|
||||
end
|
||||
|
||||
let (:claimed_recording) { FactoryGirl.create(:claimed_recording) }
|
||||
let (:recording) { claimed_recording.recording }
|
||||
|
||||
it "should render comments" do
|
||||
describe "no js required" do
|
||||
|
||||
recording = ClaimedRecording.first
|
||||
comment = "test comment"
|
||||
timestamp = "less than a minute ago"
|
||||
url = "/recordings/#{claimed_recording.id}"
|
||||
visit url
|
||||
it "shows private recording to someone who was in the session" do
|
||||
# make the session hidden
|
||||
claimed_recording.is_public = false
|
||||
claimed_recording.save!
|
||||
|
||||
fill_in "txtRecordingComment", with: comment
|
||||
find('#btnPostComment').trigger(:click)
|
||||
visit "/recordings/#{claimed_recording.id}"
|
||||
|
||||
# (1) Test a user creating a comment and ensure it displays.
|
||||
# and verify that after we visit the page, we can see the name of it
|
||||
find('strong', text: 'RECORDING NOT FOUND')
|
||||
|
||||
# comment body
|
||||
find('div.comment-text', text: comment)
|
||||
# log in the user who was a part of the session
|
||||
sign_in(claimed_recording.user)
|
||||
|
||||
# timestamp
|
||||
find('div.comment-timestamp', text: timestamp)
|
||||
visit "/recordings/#{claimed_recording.id}"
|
||||
|
||||
# (2) Test a user visiting a landing page with an existing comment.
|
||||
# and verify that after we visit the page, we can see the name of it
|
||||
find('h2', text: claimed_recording.name)
|
||||
end
|
||||
end
|
||||
|
||||
# re-visit page to reload from database
|
||||
visit url
|
||||
|
||||
# comment body
|
||||
find('div.comment-text', text: comment)
|
||||
describe "js required", :js => true, :type => :feature, :capybara_feature => true do
|
||||
|
||||
# timestamp
|
||||
find('div.comment-timestamp', text: timestamp)
|
||||
before(:each) do
|
||||
MusicSession.delete_all
|
||||
sign_in_poltergeist(user)
|
||||
end
|
||||
|
||||
|
||||
it "should render comments" do
|
||||
|
||||
recording = ClaimedRecording.first
|
||||
comment = "test comment"
|
||||
timestamp = "less than a minute ago"
|
||||
url = "/recordings/#{claimed_recording.id}"
|
||||
visit url
|
||||
|
||||
fill_in "txtRecordingComment", with: comment
|
||||
find('#btnPostComment').trigger(:click)
|
||||
|
||||
# (1) Test a user creating a comment and ensure it displays.
|
||||
|
||||
# comment body
|
||||
find('div.comment-text', text: comment)
|
||||
|
||||
# timestamp
|
||||
find('div.comment-timestamp', text: timestamp)
|
||||
|
||||
# (2) Test a user visiting a landing page with an existing comment.
|
||||
|
||||
# re-visit page to reload from database
|
||||
visit url
|
||||
|
||||
# comment body
|
||||
find('div.comment-text', text: comment)
|
||||
|
||||
# timestamp
|
||||
find('div.comment-timestamp', text: timestamp)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue