* VRFS-17; can create a session, find the other; not joining yet

This commit is contained in:
Seth Call 2012-12-14 21:22:00 -06:00
parent dde4bd0f1e
commit e7def85594
10 changed files with 134 additions and 4 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@
# Ignore all logfiles and tempfiles.
/log/*.log
/log/*.log.age
/tmp
# Ignore other unneeded files.
doc/

View File

@ -67,7 +67,7 @@ group :assets do
gem 'uglifier', '1.2.3'
end
group :test do
group :test, :cucumber do
gem 'capybara', '1.1.2'
gem 'cucumber-rails', '1.3.0', :require => false
gem 'factory_girl_rails', '4.1.0'

View File

@ -119,6 +119,7 @@ Message from Seth on sequence for creating/joining sessions:
var data = $this.formToObject();
data.client_id = app.clientId;
data.as_musician = true;
data.legal_terms = true; // this overrides the default of 'on', which isn't satisfying our concept of boolean
if (typeof(data.genres) === "string") {
data.genres = [data.genres];
}

View File

@ -116,14 +116,14 @@
Upgrade your Studio subscription to let more fans listen
</a></p>
</div>
-->
<div class="formrow">
<label>Legal Terms
<input type="checkbox"/>
<input type="checkbox" name="legal_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.
</label>
</div>
-->
</fieldset>
</div>
<div class="footer">

View File

@ -0,0 +1,48 @@
SampleApp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
require 'bcrypt'
silence_warnings do
BCrypt::Engine::DEFAULT_COST = BCrypt::Engine::MIN_COST
end
# For testing omniauth
OmniAuth.config.test_mode = true
config.websocket_gateway_enable = true
end

View File

@ -42,5 +42,7 @@ SampleApp::Application.configure do
# For testing omniauth
OmniAuth.config.test_mode = true
config.websocket_gateway_enable = false
end

View File

@ -0,0 +1,10 @@
Feature: Users can create session
In order to play music with other people
As a musician
I want to create a music session
@javascript
Scenario: Create a public music session
Given I am logged in to the client
When I create a public music session
Then I should be in a music session that other musicians can find

View File

@ -0,0 +1,41 @@
Given /^I am logged in to the client$/ do
@user = FactoryGirl.create(:user)
login(@user, page) # page == the default context
end
When /^I create a public music session$/ do
# the relatively unique name of the session we will create
@session_description = 'A new session for anyone to find and play with me'
page.find(".createsession").click
# fill out minimially required elements of the form
page.choose 'music_access_true' # public session
# pick a genre, any genre
page.select 'African', :from => 'genres'
page.fill_in 'description', :with => @session_description
# create the session
click_button 'Create Session'
# verify that the 'in-session' page is showing, with our description showing
page.find("#session-info").should have_content @session_description
end
Then /^I should be in a music session that other musicians can find$/ do
# now log in a second user
second_session = Capybara::Session.new(Capybara.current_driver, Capybara.app)
@user2 = FactoryGirl.create(:user)
login(@user2, second_session)
# click find sessions
second_session.find(".findsession").click
# and see the session with the same description we created earlier show up
second_session.find("tr[data-sortScore]").should have_content @session_description
end

View File

@ -4,6 +4,10 @@
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
# force cucumber environment
ENV['RAILS_ENV'] = 'cucumber'
# SETH: ADDED TO FORCE OUR OWN DB LOADING
require File.expand_path('../before_cucumber', __FILE__)
BeforeCucumber.new

View File

@ -0,0 +1,23 @@
module LoginHelper
def login(user, context)
context.visit root_path
# verify that the root page is showing
context.should have_content "Welcome to JamKazam"
# initiate login
context.click_link 'Sign In'
# verify that the sign in form is showing
context.should have_content "Sign in"
context.fill_in 'Email', :with => user.email
context.fill_in 'Password', :with => user.password
context.click_button 'Sign in'
# verify that the client page is showing
context.find(".createsession").should have_content "Create Session"
end
end
World(LoginHelper)