Skip to content

Commit 9bc09cd

Browse files
committed
Switches DB to postgres. Installs numerous gems (e.g. rspec, figaro, factoryGirl).
1 parent b9bea7b commit 9bc09cd

File tree

7 files changed

+239
-20
lines changed

7 files changed

+239
-20
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ rerun.txt
3636
pickle-email-*.html
3737
.project
3838
config/initializers/secret_token.rb
39+
40+
# Ignore application configuration
41+
/config/application.yml

Gemfile

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ source 'https://rubygems.org'
44
gem 'rails', '4.0.1'
55

66
# Use sqlite3 as the database for Active Record
7-
gem 'sqlite3'
7+
# gem 'sqlite3'
8+
gem 'pg'
89

910
# Use SCSS for stylesheets
1011
gem 'sass-rails', '~> 4.0.0'
@@ -33,7 +34,7 @@ group :doc do
3334
end
3435

3536
# Use ActiveModel has_secure_password
36-
# gem 'bcrypt-ruby', '~> 3.1.2'
37+
gem 'bcrypt-ruby', '~> 3.1.2'
3738

3839
# Use unicorn as the app server
3940
# gem 'unicorn'
@@ -42,4 +43,21 @@ end
4243
# gem 'capistrano', group: :development
4344

4445
# Use debugger
45-
# gem 'debugger', group: [:development, :test]
46+
gem 'debugger', group: [:development, :test]
47+
48+
gem 'figaro'
49+
50+
group :development, :test do
51+
gem 'better_errors'
52+
gem 'binding_of_caller'
53+
gem 'meta_request'
54+
gem 'rspec-rails'
55+
gem 'factory_girl_rails'
56+
end
57+
58+
group :test do
59+
gem 'capybara'
60+
gem 'guard-rspec'
61+
gem 'launchy'
62+
gem 'shoulda-matchers'
63+
end

Gemfile.lock

Lines changed: 116 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,65 @@ GEM
2525
multi_json (~> 1.3)
2626
thread_safe (~> 0.1)
2727
tzinfo (~> 0.3.37)
28+
addressable (2.3.5)
2829
arel (4.0.1)
2930
atomic (1.1.14)
31+
bcrypt-ruby (3.1.2)
32+
bcrypt-ruby (3.1.2-x86-mingw32)
33+
better_errors (1.0.1)
34+
coderay (>= 1.0.0)
35+
erubis (>= 2.6.6)
36+
binding_of_caller (0.7.2)
37+
debug_inspector (>= 0.0.1)
3038
builder (3.1.4)
39+
callsite (0.0.11)
40+
capybara (2.1.0)
41+
mime-types (>= 1.16)
42+
nokogiri (>= 1.3.3)
43+
rack (>= 1.0.0)
44+
rack-test (>= 0.5.4)
45+
xpath (~> 2.0)
46+
celluloid (0.15.2)
47+
timers (~> 1.1.0)
48+
coderay (1.0.9)
3149
coffee-rails (4.0.1)
3250
coffee-script (>= 2.2.0)
3351
railties (>= 4.0.0, < 5.0)
3452
coffee-script (2.2.0)
3553
coffee-script-source
3654
execjs
3755
coffee-script-source (1.6.3)
56+
columnize (0.3.6)
57+
debug_inspector (0.0.2)
58+
debugger (1.6.2)
59+
columnize (>= 0.3.1)
60+
debugger-linecache (~> 1.2.0)
61+
debugger-ruby_core_source (~> 1.2.3)
62+
debugger-linecache (1.2.0)
63+
debugger-ruby_core_source (1.2.3)
64+
diff-lcs (1.2.4)
3865
erubis (2.7.0)
3966
execjs (2.0.2)
67+
factory_girl (4.3.0)
68+
activesupport (>= 3.0.0)
69+
factory_girl_rails (4.3.0)
70+
factory_girl (~> 4.3.0)
71+
railties (>= 3.0.0)
72+
ffi (1.9.3)
73+
ffi (1.9.3-x86-mingw32)
74+
figaro (0.7.0)
75+
bundler (~> 1.0)
76+
rails (>= 3, < 5)
77+
formatador (0.2.4)
78+
guard (2.2.3)
79+
formatador (>= 0.2.4)
80+
listen (~> 2.1)
81+
lumberjack (~> 1.0)
82+
pry (>= 0.9.12)
83+
thor (>= 0.18.1)
84+
guard-rspec (4.0.3)
85+
guard (>= 2.1.1)
86+
rspec (~> 2.14)
4087
hike (1.2.3)
4188
i18n (0.6.5)
4289
jbuilder (1.5.2)
@@ -46,14 +93,44 @@ GEM
4693
railties (>= 3.0, < 5.0)
4794
thor (>= 0.14, < 2.0)
4895
json (1.8.1)
96+
launchy (2.3.0)
97+
addressable (~> 2.3)
98+
listen (2.2.0)
99+
celluloid (>= 0.15.2)
100+
rb-fsevent (>= 0.9.3)
101+
rb-inotify (>= 0.9)
102+
lumberjack (1.0.4)
49103
mail (2.5.4)
50104
mime-types (~> 1.16)
51105
treetop (~> 1.4.8)
106+
meta_request (0.2.8)
107+
callsite
108+
rack-contrib
109+
railties
110+
method_source (0.8.2)
52111
mime-types (1.25)
112+
mini_portile (0.5.2)
53113
minitest (4.7.5)
54114
multi_json (1.8.2)
115+
nokogiri (1.6.0)
116+
mini_portile (~> 0.5.0)
117+
nokogiri (1.6.0-x86-mingw32)
118+
mini_portile (~> 0.5.0)
119+
pg (0.17.0)
120+
pg (0.17.0-x86-mingw32)
55121
polyglot (0.3.3)
122+
pry (0.9.12.2)
123+
coderay (~> 1.0.5)
124+
method_source (~> 0.8)
125+
slop (~> 3.4)
126+
pry (0.9.12.2-x86-mingw32)
127+
coderay (~> 1.0.5)
128+
method_source (~> 0.8)
129+
slop (~> 3.4)
130+
win32console (~> 1.3)
56131
rack (1.5.2)
132+
rack-contrib (1.1.0)
133+
rack (>= 0.9.1)
57134
rack-test (0.6.2)
58135
rack (>= 1.0)
59136
rails (4.0.1)
@@ -70,8 +147,26 @@ GEM
70147
rake (>= 0.8.7)
71148
thor (>= 0.18.1, < 2.0)
72149
rake (10.1.0)
150+
rb-fsevent (0.9.3)
151+
rb-inotify (0.9.2)
152+
ffi (>= 0.5.0)
73153
rdoc (3.12.2)
74154
json (~> 1.4)
155+
rspec (2.14.1)
156+
rspec-core (~> 2.14.0)
157+
rspec-expectations (~> 2.14.0)
158+
rspec-mocks (~> 2.14.0)
159+
rspec-core (2.14.7)
160+
rspec-expectations (2.14.3)
161+
diff-lcs (>= 1.1.3, < 2.0)
162+
rspec-mocks (2.14.4)
163+
rspec-rails (2.14.0)
164+
actionpack (>= 3.0)
165+
activesupport (>= 3.0)
166+
railties (>= 3.0)
167+
rspec-core (~> 2.14.0)
168+
rspec-expectations (~> 2.14.0)
169+
rspec-mocks (~> 2.14.0)
75170
sass (3.2.12)
76171
sass-rails (4.0.1)
77172
railties (>= 4.0.0, < 5.0)
@@ -80,6 +175,9 @@ GEM
80175
sdoc (0.3.20)
81176
json (>= 1.1.3)
82177
rdoc (~> 3.10)
178+
shoulda-matchers (2.4.0)
179+
activesupport (>= 3.0.0)
180+
slop (3.4.6)
83181
sprockets (2.10.0)
84182
hike (~> 1.2)
85183
multi_json (~> 1.0)
@@ -89,11 +187,11 @@ GEM
89187
actionpack (>= 3.0)
90188
activesupport (>= 3.0)
91189
sprockets (~> 2.8)
92-
sqlite3 (1.3.8-x86-mingw32)
93190
thor (0.18.1)
94191
thread_safe (0.1.3)
95192
atomic
96193
tilt (1.4.1)
194+
timers (1.1.0)
97195
treetop (1.4.15)
98196
polyglot
99197
polyglot (>= 0.3.1)
@@ -103,17 +201,33 @@ GEM
103201
uglifier (2.3.0)
104202
execjs (>= 0.3.0)
105203
json (>= 1.8.0)
204+
win32console (1.3.2-x86-mingw32)
205+
xpath (2.0.0)
206+
nokogiri (~> 1.3)
106207

107208
PLATFORMS
209+
ruby
108210
x86-mingw32
109211

110212
DEPENDENCIES
213+
bcrypt-ruby (~> 3.1.2)
214+
better_errors
215+
binding_of_caller
216+
capybara
111217
coffee-rails (~> 4.0.0)
218+
debugger
219+
factory_girl_rails
220+
figaro
221+
guard-rspec
112222
jbuilder (~> 1.2)
113223
jquery-rails
224+
launchy
225+
meta_request
226+
pg
114227
rails (= 4.0.1)
228+
rspec-rails
115229
sass-rails (~> 4.0.0)
116230
sdoc
117-
sqlite3
231+
shoulda-matchers
118232
turbolinks
119233
uglifier (>= 1.3.0)

config/application.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,17 @@ class Application < Rails::Application
2424
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
2525
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
2626
# config.i18n.default_locale = :de
27+
28+
config.generators do |g|
29+
g.test_framework :rspec,
30+
fixtures: true,
31+
view_specs: true,
32+
helper_specs: true,
33+
routing_specs: true,
34+
controller_specs: true,
35+
request_specs: true
36+
37+
g.fixture_replacement :factory_girl, dir: "spec/factories"
38+
end
2739
end
2840
end

config/database.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,35 @@
1-
# SQLite version 3.x
2-
# gem install sqlite3
1+
# PostgreSQL. Versions 8.2 and up are supported.
2+
#
3+
# Install the pg driver:
4+
# gem install pg
5+
# On OS X with Homebrew:
6+
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7+
# On OS X with MacPorts:
8+
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9+
# On Windows:
10+
# gem install pg
11+
# Choose the win32 build.
12+
# Install PostgreSQL and put its /bin directory on your path.
13+
#
14+
# Configure Using Gemfile
15+
# gem 'pg'
316
#
4-
# Ensure the SQLite 3 gem is defined in your Gemfile
5-
# gem 'sqlite3'
617
development:
7-
adapter: sqlite3
8-
database: db/development.sqlite3
18+
adapter: postgresql
19+
encoding: unicode
20+
database: fantac_development
921
pool: 5
1022
timeout: 5000
11-
1223
# Warning: The database defined as "test" will be erased and
1324
# re-generated from your development database when you run "rake".
1425
# Do not set this db to the same as development or production.
1526
test:
16-
adapter: sqlite3
17-
database: db/test.sqlite3
27+
adapter: postgresql
28+
encoding: unicode
29+
database: fantac_test
1830
pool: 5
19-
timeout: 5000
20-
2131
production:
22-
adapter: sqlite3
23-
database: db/production.sqlite3
24-
pool: 5
25-
timeout: 5000
32+
adapter: postgresql
33+
encoding: unicode
34+
database: fantac_production
35+
pool: 5

db/schema.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# encoding: UTF-8
2+
# This file is auto-generated from the current state of the database. Instead
3+
# of editing this file, please use the migrations feature of Active Record to
4+
# incrementally modify your database, and then regenerate this schema definition.
5+
#
6+
# Note that this schema.rb definition is the authoritative source for your
7+
# database schema. If you need to create the application database on another
8+
# system, you should be using db:schema:load, not running all the migrations
9+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
10+
# you'll amass, the slower it'll run and the greater likelihood for issues).
11+
#
12+
# It's strongly recommended that you check this file into your version control system.
13+
14+
ActiveRecord::Schema.define(version: 0) do
15+
16+
# These are extensions that must be enabled in order to support this database
17+
enable_extension "plpgsql"
18+
19+
end

spec/spec_helper.rb

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This file is copied to spec/ when you run 'rails generate rspec:install'
2+
ENV["RAILS_ENV"] ||= 'test'
3+
require File.expand_path("../../config/environment", __FILE__)
4+
require 'rspec/rails'
5+
require 'rspec/autorun'
6+
require 'capybara/rails'
7+
8+
# Requires supporting ruby files with custom matchers and macros, etc,
9+
# in spec/support/ and its subdirectories.
10+
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
11+
12+
# Checks for pending migrations before tests are run.
13+
# If you are not using ActiveRecord, you can remove this line.
14+
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
15+
16+
RSpec.configure do |config|
17+
# ## Mock Framework
18+
#
19+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
20+
#
21+
# config.mock_with :mocha
22+
# config.mock_with :flexmock
23+
# config.mock_with :rr
24+
25+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
26+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
27+
28+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
29+
# examples within a transaction, remove the following line or assign false
30+
# instead of true.
31+
config.use_transactional_fixtures = true
32+
33+
# If true, the base class of anonymous controllers will be inferred
34+
# automatically. This will be the default behavior in future versions of
35+
# rspec-rails.
36+
config.infer_base_class_for_anonymous_controllers = false
37+
38+
# Run specs in random order to surface order dependencies. If you find an
39+
# order dependency and want to debug it, you can fix the order by providing
40+
# the seed, which is printed after each run.
41+
# --seed 1234
42+
config.order = "random"
43+
end

0 commit comments

Comments
 (0)