require 'spec_helper'

describe ShareTokensController, type: :controller do
  render_views

  let(:user) { FactoryGirl.create(:user) }
  let(:music_session) {FactoryGirl.create(:active_music_session, creator: user) }
  let(:claimed_recording) {FactoryGirl.create(:claimed_recording) }

  it "resolves music session" do
    music_session.touch
    get :shareable_resolver, :id => music_session.music_session.share_token.token

    location_header = response.headers["Location"]
    location_header.should == music_session_detail_url(music_session.id)

  end

  it "resolves claimed recording" do
    claimed_recording.touch
    get :shareable_resolver, :id => claimed_recording.share_token.token

    location_header = response.headers["Location"]
    location_header.should == recording_detail_url(claimed_recording.id)

  end

end
