Skip to content

Commit

Permalink
TEST: Register as a new user (#28).
Browse files Browse the repository at this point in the history
  • Loading branch information
benel committed May 22, 2015
1 parent 845c839 commit 8f45702
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--color
11 changes: 9 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
services: couchdb
language: node_js
language:
- node_js
- ruby
node_js: "0.12"
addons:
hosts:
- auth.local
- cassandre.local
- couchdb.local
- xcouchdb.local
Expand All @@ -16,6 +19,8 @@ install:
- node app/proxy.js >/dev/null &
# Install CouchApp
- sudo pip install couchapp
# Install Capybara
- gem install capybara-webkit rspec
# Install Cassandre
- curl -X PUT -d '"false"' localhost:5984/_config/httpd/secure_rewrites
- curl -X PUT localhost:5984/cassandre
Expand All @@ -29,4 +34,6 @@ install:
- curl -X PUT localhost:5984/cassandre/iamlate -d '{"corpus":"Wonderland", "name":"I am late"}'
- curl -X PUT localhost:5984/_users/org.couchdb.user:hatter -H 'Accept:application/json' -H 'Content-Type:application/json' -d '{"name":"hatter", "password":"teaparty", "roles":[], "type":"user"}'
- curl -X PUT localhost:5984/_config/admins/carroll -d '"curiouser"'
script: jasmine-node spec/api/
script:
- jasmine-node spec/api/
- xvfb-run rspec spec/features/*
23 changes: 23 additions & 0 deletions spec/features/register.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'spec_helper'

feature 'Register' do

scenario 'as a new user' do
visit '/register.html#http://couchdb.local:1337/_session'
fill_in 'Username', :with => a_string()
fill_in 'Password', :with => 'secret'
fill_in 'Confirm password', :with => 'secret'
click_on 'submit'
expect(page).to have_content "Your account has been created"
end

scenario 'not as an existing user' do
visit '/register.html#http://couchdb.local:1337/_session'
fill_in 'Username', :with => 'hatter'
fill_in 'Password', :with => 'secret'
fill_in 'Confirm password', :with => 'secret'
click_on 'submit'
expect(page).to have_content 'username already exists'
end

end
17 changes: 17 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'capybara/rspec'
require 'capybara/webkit'

Capybara.run_server = false
Capybara.default_driver = :webkit
Capybara.app_host = 'http://auth.local:1337'

RSpec.configure do |config|
config.before(:each) do
page.driver.allow_url 'auth.local'
page.driver.allow_url 'couchdb.local'
end
end

def a_string()
s = ('a'..'z').to_a.shuffle[0,8].join
end

0 comments on commit 8f45702

Please sign in to comment.