Skip to content

Commit c01f212

Browse files
committed
Added rspec and some other dev and test tools. Removed test folder.
1 parent 9c0fabe commit c01f212

26 files changed

+188
-190
lines changed

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--color

Gemfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,28 @@ gem 'rails', '3.2.9'
77

88
group :development do
99
gem 'sqlite3'
10+
gem 'better_errors'
11+
gem 'binding_of_caller'
1012
end
1113

1214
group :production do
1315
gem 'pg'
1416
gem 'thin'
1517
end
1618

17-
18-
19+
# This is in both groups so rake tasks work properly
20+
gem 'rspec-rails', :group => [:development, :test]
21+
22+
group :test do
23+
gem 'factory_girl_rails'
24+
gem 'shoulda-matchers'
25+
gem 'guard-rspec'
26+
gem 'spork'
27+
gem 'guard-spork'
28+
gem 'capybara'
29+
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
30+
gem 'ffaker' # Faster version of faker
31+
end
1932

2033
# Gems used only for assets and not required
2134
# in production environments by default.

Gemfile.lock

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,28 @@ GEM
4444
activesupport (>= 3.0.0)
4545
arel (3.0.2)
4646
bcrypt-ruby (3.0.1)
47+
better_errors (0.7.0)
48+
coderay (>= 1.0.0)
49+
erubis (>= 2.6.6)
50+
binding_of_caller (0.7.1)
51+
debug_inspector (>= 0.0.1)
4752
bourbon (3.0.1)
4853
sass (>= 3.2.0)
4954
thor
55+
bourne (1.1.2)
56+
mocha (= 0.10.5)
5057
builder (3.0.4)
58+
capybara (2.0.2)
59+
mime-types (>= 1.16)
60+
nokogiri (>= 1.3.3)
61+
rack (>= 1.0.0)
62+
rack-test (>= 0.5.4)
63+
selenium-webdriver (~> 2.0)
64+
xpath (~> 1.0.0)
65+
childprocess (0.3.8)
66+
ffi (~> 1.0, >= 1.0.11)
5167
chunky_png (1.2.7)
68+
coderay (1.0.9)
5269
coffee-rails (3.2.2)
5370
coffee-script (>= 2.2.0)
5471
railties (~> 3.2.0)
@@ -63,19 +80,41 @@ GEM
6380
compass-rails (1.0.3)
6481
compass (>= 0.12.2, < 0.14)
6582
daemons (1.1.9)
83+
debug_inspector (0.0.2)
6684
devise (2.2.2)
6785
bcrypt-ruby (~> 3.0)
6886
orm_adapter (~> 0.1)
6987
railties (~> 3.1)
7088
warden (~> 1.2.1)
89+
diff-lcs (1.2.1)
7190
erubis (2.7.0)
7291
eventmachine (1.0.0)
7392
execjs (1.4.0)
7493
multi_json (~> 1.0)
94+
factory_girl (4.2.0)
95+
activesupport (>= 3.0.0)
96+
factory_girl_rails (4.2.1)
97+
factory_girl (~> 4.2.0)
98+
railties (>= 3.0.0)
7599
fastercsv (1.5.5)
100+
ffaker (1.15.0)
101+
ffi (1.4.0)
76102
formtastic (2.2.1)
77103
actionpack (>= 3.0)
78104
fssm (0.2.9)
105+
guard (1.6.2)
106+
listen (>= 0.6.0)
107+
lumberjack (>= 1.0.2)
108+
pry (>= 0.9.10)
109+
terminal-table (>= 1.4.3)
110+
thor (>= 0.14.6)
111+
guard-rspec (2.4.1)
112+
guard (>= 1.1)
113+
rspec (~> 2.11)
114+
guard-spork (1.4.2)
115+
childprocess (>= 0.2.3)
116+
guard (>= 1.1)
117+
spork (>= 0.8.4)
79118
has_scope (0.5.1)
80119
hike (1.2.1)
81120
i18n (0.6.1)
@@ -90,6 +129,8 @@ GEM
90129
kaminari (0.14.1)
91130
actionpack (>= 3.0.0)
92131
activesupport (>= 3.0.0)
132+
listen (0.7.2)
133+
lumberjack (1.0.2)
93134
mail (2.4.4)
94135
i18n (>= 0.4.0)
95136
mime-types (~> 1.16)
@@ -99,17 +140,26 @@ GEM
99140
activerecord (~> 3.1)
100141
activesupport (~> 3.1)
101142
polyamorous (~> 0.5.0)
143+
metaclass (0.0.1)
144+
method_source (0.8.1)
102145
mime-types (1.19)
146+
mocha (0.10.5)
147+
metaclass (~> 0.0.1)
103148
modular-scale (1.0.6)
104149
compass (>= 0.12.1)
105150
sass (>= 3.2.0)
106151
sassy-math (>= 1.5)
107152
multi_json (1.5.0)
153+
nokogiri (1.5.6)
108154
orm_adapter (0.4.0)
109155
pg (0.14.1)
110156
polyamorous (0.5.0)
111157
activerecord (~> 3.0)
112158
polyglot (0.3.3)
159+
pry (0.9.12)
160+
coderay (~> 1.0.5)
161+
method_source (~> 0.8)
162+
slop (~> 3.4)
113163
rack (1.4.4)
114164
rack-cache (1.2)
115165
rack (>= 0.4)
@@ -133,23 +183,51 @@ GEM
133183
rdoc (~> 3.4)
134184
thor (>= 0.14.6, < 2.0)
135185
rake (10.0.3)
186+
rb-fsevent (0.9.3)
136187
rdoc (3.12)
137188
json (~> 1.4)
138189
responders (0.9.3)
139190
railties (~> 3.1)
191+
rspec (2.13.0)
192+
rspec-core (~> 2.13.0)
193+
rspec-expectations (~> 2.13.0)
194+
rspec-mocks (~> 2.13.0)
195+
rspec-core (2.13.0)
196+
rspec-expectations (2.13.0)
197+
diff-lcs (>= 1.1.3, < 2.0)
198+
rspec-mocks (2.13.0)
199+
rspec-rails (2.13.0)
200+
actionpack (>= 3.0)
201+
activesupport (>= 3.0)
202+
railties (>= 3.0)
203+
rspec-core (~> 2.13.0)
204+
rspec-expectations (~> 2.13.0)
205+
rspec-mocks (~> 2.13.0)
206+
rubyzip (0.9.9)
140207
sass (3.2.5)
141208
sass-rails (3.2.6)
142209
railties (~> 3.2.0)
143210
sass (>= 3.1.10)
144211
tilt (~> 1.3)
145212
sassy-math (1.5)
146213
compass (~> 0.11)
214+
selenium-webdriver (2.30.0)
215+
childprocess (>= 0.2.5)
216+
multi_json (~> 1.0)
217+
rubyzip
218+
websocket (~> 1.0.4)
219+
shoulda-matchers (1.4.2)
220+
activesupport (>= 3.0.0)
221+
bourne (~> 1.1.2)
222+
slop (3.4.3)
223+
spork (0.9.2)
147224
sprockets (2.2.2)
148225
hike (~> 1.2)
149226
multi_json (~> 1.0)
150227
rack (~> 1.0)
151228
tilt (~> 1.1, != 1.3.0)
152229
sqlite3 (1.3.7)
230+
terminal-table (1.4.5)
153231
thin (1.5.0)
154232
daemons (>= 1.0.9)
155233
eventmachine (>= 0.12.6)
@@ -165,6 +243,9 @@ GEM
165243
multi_json (~> 1.0, >= 1.0.2)
166244
warden (1.2.1)
167245
rack (>= 1.0)
246+
websocket (1.0.7)
247+
xpath (1.0.0)
248+
nokogiri (~> 1.3)
168249
zurb-foundation (3.2.4)
169250
compass (>= 0.12.2)
170251
modular-scale (= 1.0.6)
@@ -176,12 +257,23 @@ PLATFORMS
176257

177258
DEPENDENCIES
178259
activeadmin
260+
better_errors
261+
binding_of_caller
262+
capybara
179263
coffee-rails (~> 3.2.1)
180264
compass-rails
265+
factory_girl_rails
266+
ffaker
267+
guard-rspec
268+
guard-spork
181269
jquery-rails
182270
pg
183271
rails (= 3.2.9)
272+
rb-fsevent
273+
rspec-rails
184274
sass-rails (~> 3.2.3)
275+
shoulda-matchers
276+
spork
185277
sqlite3
186278
thin
187279
uglifier (>= 1.0.3)

Guardfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# A sample Guardfile
2+
# More info at https://github.com/guard/guard#readme
3+
4+
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
5+
watch('config/application.rb')
6+
watch('config/environment.rb')
7+
watch('config/environments/test.rb')
8+
watch(%r{^config/initializers/.+\.rb$})
9+
watch('Gemfile')
10+
watch('Gemfile.lock')
11+
watch('spec/spec_helper.rb') { :rspec }
12+
watch('test/test_helper.rb') { :test_unit }
13+
watch(%r{features/support/}) { :cucumber }
14+
end
15+
16+
guard 'rspec', :cli => '--drb' do
17+
watch(%r{^spec/.+_spec\.rb$})
18+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
19+
watch('spec/spec_helper.rb') { "spec" }
20+
21+
# Rails example
22+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
23+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
24+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
25+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
26+
watch('config/routes.rb') { "spec/routing" }
27+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
28+
29+
# Capybara features specs
30+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
31+
32+
# Turnip features and steps
33+
watch(%r{^spec/acceptance/(.+)\.feature$})
34+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
35+
end
36+

db/development.sqlite3

28 KB
Binary file not shown.

spec/factories/admin_users.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FactoryGirl.define do
2+
factory :admin_user do
3+
email { Faker::Internet.email }
4+
password "password"
5+
password_confirmation "password"
6+
end
7+
end

spec/models/admin_user_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require 'spec_helper'
2+
3+
describe AdminUser do
4+
it "saving AdminUser should increase count by 1" do
5+
count = AdminUser.count
6+
FactoryGirl.create(:admin_user)
7+
AdminUser.count.should eq(count + 1)
8+
end
9+
end

spec/spec_helper.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
require 'rubygems'
2+
require 'spork'
3+
#uncomment the following line to use spork with the debugger
4+
#require 'spork/ext/ruby-debug'
5+
6+
Spork.prefork do
7+
# This file is copied to spec/ when you run 'rails generate rspec:install'
8+
ENV["RAILS_ENV"] ||= 'test'
9+
require File.expand_path("../../config/environment", __FILE__)
10+
require 'rspec/rails'
11+
require 'rspec/autorun'
12+
require 'capybara/rspec'
13+
14+
# Requires supporting ruby files with custom matchers and macros, etc,
15+
# in spec/support/ and its subdirectories.
16+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
17+
18+
RSpec.configure do |config|
19+
config.mock_with :rspec
20+
config.use_transactional_fixtures = true
21+
config.infer_base_class_for_anonymous_controllers = false
22+
config.order = "random"
23+
end
24+
end
25+
26+
Spork.each_run do
27+
FactoryGirl.reload
28+
end

test/fixtures/.gitkeep

Whitespace-only changes.

test/fixtures/admin_users.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)