Add authentication and User model
* Add User model * Add SessionsController * Add password authentication on User * Request authentication for all actions except sign in * Add some helpers for ApplicationController * Update features to work with mandatory authentication
This commit is contained in:
@@ -4,6 +4,9 @@ Feature: Home
|
||||
As a listener
|
||||
I want to access the main features and valuable content from the homepage
|
||||
|
||||
Background:
|
||||
Given I am signed in
|
||||
|
||||
Scenario: Playlist access
|
||||
Given a playlist named "Electro"
|
||||
When I am on the home page
|
||||
|
@@ -4,6 +4,9 @@ Feature: Playlists
|
||||
As a listener
|
||||
I want to manage some playlists
|
||||
|
||||
Background:
|
||||
Given I am signed in
|
||||
|
||||
Scenario: List playlists
|
||||
Given a playlist named "Electro"
|
||||
And a playlist named "Reggae"
|
||||
|
17
features/sessions.feature
Normal file
17
features/sessions.feature
Normal file
@@ -0,0 +1,17 @@
|
||||
Feature: User
|
||||
|
||||
So that I can manage my own content
|
||||
As a listener
|
||||
I want the application to require a valid authentication
|
||||
|
||||
Scenario: Unauthenticated user
|
||||
Given I am not signed in
|
||||
When I go to the home page
|
||||
Then I should be redirected to the sign in page
|
||||
|
||||
Scenario: User authentication
|
||||
Given I am not signed in
|
||||
When I go to the home page
|
||||
Then I should be redirected to the sign in page
|
||||
When I submit valid credentials
|
||||
Then I should be redirected to the home page
|
26
features/step_definitions/sessions_step.rb
Normal file
26
features/step_definitions/sessions_step.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
Given /^I am not signed in$/ do
|
||||
|
||||
end
|
||||
|
||||
Given /^I am signed in$/ do
|
||||
user = Factory.create(:user)
|
||||
visit new_session_path
|
||||
fill_in('Email', :with => user.email)
|
||||
fill_in('Password', :with => user.password)
|
||||
click_button('Sign in')
|
||||
end
|
||||
|
||||
Then /^I should be redirected to the sign in page$/ do
|
||||
current_path.should == new_session_path
|
||||
end
|
||||
|
||||
Then /^I should be redirected to the home page$/ do
|
||||
current_path.should == root_path
|
||||
end
|
||||
|
||||
When /^I submit valid credentials$/ do
|
||||
user = Factory.create(:user)
|
||||
fill_in('Email', :with => user.email)
|
||||
fill_in('Password', :with => user.password)
|
||||
click_button('Sign in')
|
||||
end
|
@@ -16,6 +16,5 @@ end
|
||||
|
||||
Then /^it should provide an audio stream for "([^"]*)"$/ do |name|
|
||||
page.should have_xpath "//audio[@src='#{stream_track_path(@track)}']"
|
||||
get find('audio')[:src]
|
||||
last_response.status.should == 200
|
||||
visit find('audio')[:src]
|
||||
end
|
||||
|
@@ -4,6 +4,9 @@ Feature: Tracks
|
||||
As a listener
|
||||
I want to add, manage and listen some tracks
|
||||
|
||||
Background:
|
||||
Given I am signed in
|
||||
|
||||
Scenario: Show track
|
||||
Given a track named "Mega song"
|
||||
When I go to the track page for "Mega song"
|
||||
|
Reference in New Issue
Block a user