Skip to content

Commit

Permalink
add rspec capybara jasmine and tests for pages
Browse files Browse the repository at this point in the history
  • Loading branch information
rschumann committed May 26, 2014
1 parent 1150e8f commit eb63617
Show file tree
Hide file tree
Showing 27 changed files with 453 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
/media
/public/uploads

.DS_Store

.gitignore
.ruby-version
.rvmrc
.env
.idea/

# Ingore Sublime project files:
*.sublime-*
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--color
25 changes: 18 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
source 'https://rubygems.org'

ruby '2.1.0'

gem 'rails', '4.0.4'
Expand All @@ -14,19 +13,31 @@ gem 'carrierwave'
gem 'fog'
gem 'rmagick', :require => false
gem 'unf'
gem 'newrelic_rpm'
gem 'unicorn'

group :development, :test do
gem 'rspec-rails', '~> 2.0'
gem 'launchy' # this lets us call save_and_open_page to see what's on a page for debugging capybara tests
gem 'capybara', '2.0.3' # capybara-webkit works with this version
gem 'show_me_the_cookies'
gem 'factory_girl_rails'
gem 'shoulda-matchers'
gem 'jasmine-rails'
gem 'guard'
gem 'guard-jasmine-rails'
gem 'database_cleaner'
gem 'debugger'
end
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'foreman'
gem 'capistrano'
end

group :development, :test do
gem 'debugger'
end

group :production do
gem 'pg'
gem 'rails_12factor'
end

gem 'newrelic_rpm'
gem 'unicorn'
103 changes: 98 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,63 @@ GEM
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
addressable (2.3.6)
arel (4.0.2)
atomic (1.1.16)
better_errors (1.1.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.1.4)
capistrano (3.1.0)
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
capybara (2.0.3)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 1.0.0)
carrierwave (0.10.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
celluloid (0.15.2)
timers (~> 1.1.0)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
chunky_png (1.3.0)
coderay (1.1.0)
columnize (0.3.6)
compass (0.12.4)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.2.17)
compass-rails (1.1.2)
compass (>= 0.12.2)
database_cleaner (1.2.0)
debug_inspector (0.0.2)
debugger (1.6.6)
columnize (>= 0.3.1)
debugger-linecache (~> 1.2.0)
debugger-ruby_core_source (~> 1.3.2)
debugger-linecache (1.2.0)
debugger-ruby_core_source (1.3.2)
diff-lcs (1.2.5)
dotenv (0.10.0)
erubis (2.7.0)
ethon (0.7.0)
ffi (>= 1.3.0)
excon (0.32.1)
execjs (2.0.2)
factory_girl (4.4.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.4.1)
factory_girl (~> 4.4.0)
railties (>= 3.0.0)
ffi (1.9.3)
fog (1.21.0)
fog-brightbox
Expand All @@ -80,23 +105,45 @@ GEM
thor (>= 0.13.6)
formatador (0.2.4)
fssm (0.2.10)
guard (2.6.1)
formatador (>= 0.2.4)
listen (~> 2.7)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
guard-jasmine-rails (1.1.1)
guard
hike (1.2.3)
httparty (0.13.0)
json (~> 1.8)
multi_xml (>= 0.5.2)
i18n (0.6.9)
jasmine-core (2.0.0)
jasmine-rails (0.9.0)
jasmine-core (>= 1.3, < 3.0)
phantomjs
railties (>= 3.1.0)
sprockets-rails
jquery-rails (3.1.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
kgio (2.9.2)
launchy (2.4.2)
addressable (~> 2.3)
listen (2.7.5)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.5)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.5.3)
minitest (4.7.5)
multi_json (1.9.2)
multi_json (1.10.1)
multi_xml (0.5.5)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
Expand All @@ -105,7 +152,12 @@ GEM
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
pg (0.17.1)
phantomjs (1.9.7.0)
polyglot (0.3.4)
pry (0.9.12.6)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
Expand All @@ -128,14 +180,40 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
rake (10.2.2)
rake (10.3.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.4)
ffi (>= 0.5.0)
rmagick (2.13.2)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.6)
rspec-rails (2.14.2)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rubyzip (1.1.3)
sass (3.2.18)
sass-rails (4.0.2)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2.0)
sprockets (~> 2.8, <= 2.11.0)
sprockets-rails (~> 2.0.0)
selenium-webdriver (2.41.0)
childprocess (>= 0.5.0)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0.4)
shoulda-matchers (2.5.0)
activesupport (>= 3.0.0)
show_me_the_cookies (2.2.0)
capybara (~> 2.0)
slop (3.5.0)
sprockets (2.11.0)
hike (~> 1.2)
multi_json (~> 1.0)
Expand All @@ -152,9 +230,9 @@ GEM
term-ansicolor (1.3.0)
tins (~> 1.0)
thor (0.19.1)
thread_safe (0.3.1)
atomic (>= 1.1.7, < 2)
thread_safe (0.3.3)
tilt (1.4.1)
timers (1.1.0)
tins (1.0.1)
treetop (1.4.15)
polyglot
Expand All @@ -173,25 +251,40 @@ GEM
rack
raindrops (~> 0.7)
useragent (0.10.0)
websocket (1.0.7)
xpath (1.0.0)
nokogiri (~> 1.3)

PLATFORMS
ruby

DEPENDENCIES
better_errors
binding_of_caller
capistrano
capybara (= 2.0.3)
carrierwave
compass-rails (= 1.1.2)
database_cleaner
debugger
factory_girl_rails
fog
foreman
guard
guard-jasmine-rails
httparty
jasmine-rails
jquery-rails
launchy
newrelic_rpm
pg
rails (= 4.0.4)
rails_12factor
rmagick
rspec-rails (~> 2.0)
sass-rails (~> 4.0.0)
shoulda-matchers
show_me_the_cookies
typhoeus
uglifier (>= 1.3.0)
unf
Expand Down
9 changes: 9 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard 'jasmine-rails', all_on_start: true do
watch(%r{spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$})
watch(%r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)(?:\.\w+)*$}) { |m| "spec/javascripts/#{ m[1] }_spec.#{ m[2] }" }
watch(%r{lib/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)(?:\.\w+)*$}) { |m| "spec/javascripts/#{ m[1] }_spec.#{ m[2] }" }
watch(%r{vendor/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)(?:\.\w+)*$}) { |m| "spec/javascripts/#{ m[1] }_spec.#{ m[2] }" }
end
5 changes: 4 additions & 1 deletion app/uploaders/media_uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class MediaUploader < CarrierWave::Uploader::Base

# Choose what kind of storage to use for this uploader:
# storage :file
storage :fog

def cache_dir
"#{Rails.root}/tmp/uploads"
end

# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
Expand Down
16 changes: 16 additions & 0 deletions bin/autospec
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'autospec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rspec-core', 'autospec')
16 changes: 16 additions & 0 deletions bin/rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rspec-core', 'rspec')
28 changes: 19 additions & 9 deletions config/initializers/carrierwave.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
:region => 'us-west-2'
}
config.fog_directory = ENV['S3_BUCKET_NAME']
config.fog_attributes = {'Cache-Control' => 'max-age = 315576000'}
config.fog_use_ssl_for_aws = false
# For testing, upload files to local `tmp` folder.
if Rails.env.development?
config.storage = :file
elsif Rails.env.test?
config.storage = :file
else
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
:region => 'us-west-2'
}
config.storage = :fog
config.fog_directory = ENV['S3_BUCKET_NAME']
config.fog_attributes = {'Cache-Control' => 'max-age = 315576000'}
config.fog_use_ssl_for_aws = false
end
# To let CarrierWave work on heroku
config.cache_dir = "#{Rails.root}/tmp/uploads"
end
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Gfw::Application.routes.draw do

mount JasmineRails::Engine => '/specs' if defined?(JasmineRails)
resources :stories

# terms
Expand Down
Binary file added public/media/upload/big_coffee-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/upload/big_default_taxon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/upload/coffee-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/upload/default_taxon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/upload/thumb_coffee-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/upload/thumb_default_taxon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit eb63617

Please sign in to comment.