Refactor tracks specs
This commit is contained in:
parent
79c4aef669
commit
e940b3f246
@ -1,29 +1,29 @@
|
|||||||
describe 'API tracks' do
|
describe 'API tracks' do
|
||||||
include AcceptanceHelpers
|
include AcceptanceHelpers
|
||||||
|
|
||||||
before { api_sign_in }
|
let(:track) { create :track_with_sound }
|
||||||
|
let(:other_track) { create :track }
|
||||||
|
|
||||||
|
before { api_sign_in and track and other_track }
|
||||||
|
|
||||||
it 'lists tracks' do
|
it 'lists tracks' do
|
||||||
track_1 = create :track_with_sound, name: 'Track 1'
|
|
||||||
track_2 = create :track, name: 'Track 2'
|
|
||||||
get api_tracks_path, format: :json
|
get api_tracks_path, format: :json
|
||||||
expect(json).to eq(
|
expect(json).to eq(
|
||||||
tracks: [
|
tracks: [
|
||||||
{
|
{
|
||||||
id: track_1.id,
|
id: track.id,
|
||||||
name: 'Track 1',
|
name: track.name,
|
||||||
sound_url: api_sound_url(track_1.sound)
|
sound_url: api_sound_url(track.sound)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: track_2.id,
|
id: other_track.id,
|
||||||
name: 'Track 2'
|
name: other_track.name
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'shows a track' do
|
it 'shows a track' do
|
||||||
track = create :track
|
|
||||||
get api_track_path track, format: :json
|
get api_track_path track, format: :json
|
||||||
expect(json).to eq(
|
expect(json).to eq(
|
||||||
track: {
|
track: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user