summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2015-10-03 12:35:48 +0200
committerHarald Eilertsen <haraldei@anduin.net>2015-10-03 12:56:00 +0200
commit08e71721514a8fad599832c4846b1cfb45b0f12c (patch)
treeb6c11bc3de4a7231c92d9576828e0e061e94be48
parent12a0f88114b28f7ea721af2ac857822f3bdc16bb (diff)
downloadnorsk-urskog-registrations-08e71721514a8fad599832c4846b1cfb45b0f12c.tar.gz
norsk-urskog-registrations-08e71721514a8fad599832c4846b1cfb45b0f12c.tar.bz2
norsk-urskog-registrations-08e71721514a8fad599832c4846b1cfb45b0f12c.zip
Transform to a Sinatra app
-rw-r--r--.rspec3
-rw-r--r--Gemfile5
-rw-r--r--Gemfile.lock38
-rw-r--r--config.ru2
-rw-r--r--public/regform.js (renamed from registration-form.js)0
-rw-r--r--public/styles.css (renamed from registration-form.css)0
-rw-r--r--registration.rb10
-rw-r--r--spec/registration_spec.rb14
-rw-r--r--spec/spec_helper.rb3
-rw-r--r--views/index.erb (renamed from registration-form.html)0
10 files changed, 75 insertions, 0 deletions
diff --git a/.rspec b/.rspec
new file mode 100644
index 0000000..43ae203
--- /dev/null
+++ b/.rspec
@@ -0,0 +1,3 @@
+--color
+--require spec_helper
+--format documentation
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..5ec35cb
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,5 @@
+source "https://rubygems.org"
+
+gem "sinatra"
+gem "rspec"
+gem "rack-test"
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000..cc8a85b
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,38 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ diff-lcs (1.2.5)
+ rack (1.6.4)
+ rack-protection (1.5.3)
+ rack
+ rack-test (0.6.3)
+ rack (>= 1.0)
+ rspec (3.3.0)
+ rspec-core (~> 3.3.0)
+ rspec-expectations (~> 3.3.0)
+ rspec-mocks (~> 3.3.0)
+ rspec-core (3.3.2)
+ rspec-support (~> 3.3.0)
+ rspec-expectations (3.3.1)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.3.0)
+ rspec-mocks (3.3.2)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.3.0)
+ rspec-support (3.3.0)
+ sinatra (1.4.6)
+ rack (~> 1.4)
+ rack-protection (~> 1.4)
+ tilt (>= 1.3, < 3)
+ tilt (2.0.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ rack-test
+ rspec
+ sinatra
+
+BUNDLED WITH
+ 1.10.6
diff --git a/config.ru b/config.ru
new file mode 100644
index 0000000..897dd21
--- /dev/null
+++ b/config.ru
@@ -0,0 +1,2 @@
+require './registration.rb'
+run RegistrationApp
diff --git a/registration-form.js b/public/regform.js
index 00e5486..00e5486 100644
--- a/registration-form.js
+++ b/public/regform.js
diff --git a/registration-form.css b/public/styles.css
index d0b13fc..d0b13fc 100644
--- a/registration-form.css
+++ b/public/styles.css
diff --git a/registration.rb b/registration.rb
new file mode 100644
index 0000000..de9ec75
--- /dev/null
+++ b/registration.rb
@@ -0,0 +1,10 @@
+require 'sinatra/base'
+
+class RegistrationApp < Sinatra::Base
+
+ get '/' do
+ erb :index
+ end
+
+ run! if app_file == $0
+end
diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb
new file mode 100644
index 0000000..1f89321
--- /dev/null
+++ b/spec/registration_spec.rb
@@ -0,0 +1,14 @@
+describe RegistrationApp do
+ include Rack::Test::Methods
+
+ def app
+ RegistrationApp
+ end
+
+ describe 'GET index' do
+ it 'displays the registration form' do
+ get '/'
+ expect(last_response).to be_ok
+ end
+ end
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644
index 0000000..c7171e6
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1,3 @@
+require_relative '../registration'
+require 'rspec'
+require 'rack/test'
diff --git a/registration-form.html b/views/index.erb
index 1aeb2e5..1aeb2e5 100644
--- a/registration-form.html
+++ b/views/index.erb