Skip to content

Commit

Permalink
Installed tools for testing
Browse files Browse the repository at this point in the history
 * RSpec
 * FactoryGirl
 * Capybara
  • Loading branch information
Envek committed Dec 26, 2012
1 parent 386d125 commit 6be7275
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--colour
--format documentation
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,10 @@ group :development do
gem "rvm-capistrano"
gem 'ruby-debug'
end

gem 'rspec-rails', :group => [:development, :test]

group :test do
gem 'factory_girl_rails'
gem 'capybara'
end
41 changes: 40 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ GEM
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
capybara (1.1.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
childprocess (0.2.2)
ffi (~> 1.0.6)
chronic (0.8.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
Expand All @@ -62,11 +71,17 @@ GEM
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.1)
diff-lcs (1.1.3)
dropbox-sdk (1.2)
json
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
factory_girl (2.1.0)
factory_girl_rails (1.2.0)
factory_girl (~> 2.1.0)
railties (>= 3.0.0)
ffi (1.0.9)
haml (3.1.7)
highline (1.6.15)
hike (1.2.1)
Expand All @@ -82,6 +97,7 @@ GEM
jquery-ui-themes (0.0.8)
httparty
json (1.7.5)
json_pure (1.6.0)
kgio (2.7.4)
libv8 (3.11.8.4)
linecache (0.46)
Expand Down Expand Up @@ -137,6 +153,19 @@ GEM
rails (>= 3.1.3)
redcarpet (2.2.2)
ref (1.0.2)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.6.0)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
Expand All @@ -154,11 +183,16 @@ GEM
tilt (~> 1.3)
select2-rails (3.2.1)
thor (~> 0.14)
sprockets (2.2.2)
selenium-webdriver (2.6.0)
childprocess (>= 0.2.1)
ffi (>= 1.0.7)
hike (~> 1.2)
json_pure
multi_json (~> 1.0)
rack (~> 1.0)
rubyzip
tilt (~> 1.1, != 1.3.0)
sprockets (2.2.2)
therubyracer (0.11.0)
ref
thor (0.16.0)
Expand All @@ -183,6 +217,8 @@ GEM
whenever (0.8.0)
activesupport (>= 2.3.4)
chronic (>= 0.6.3)
xpath (0.1.4)
nokogiri (~> 1.3)

PLATFORMS
ruby
Expand All @@ -192,10 +228,12 @@ DEPENDENCIES
axlsx_rails
backup (~> 3.0)
capistrano
capybara
coffee-rails (~> 3.2.0)
devise (~> 1.5.0)
dropbox-sdk (~> 1.2.0)
erubis
factory_girl_rails
haml
jquery-rails
jquery-ui-themes
Expand All @@ -209,6 +247,7 @@ DEPENDENCIES
rails (~> 3.2.0)
recordselect
redcarpet
rspec-rails
ruby-debug
russian
rvm-capistrano
Expand Down
Empty file added spec/factories/.gitkeep
Empty file.
34 changes: 34 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

RSpec.configure do |config|
# == Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
config.mock_with :rspec

# Use FactoryGirl without annoying FactoryGirl prefix
config.include FactoryGirl::Syntax::Methods

# Use Devise
config.include Devise::TestHelpers, :type => :controller

# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"

# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
end
12 changes: 7 additions & 5 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'capybara/rails'

class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
fixtures :all
include FactoryGirl::Syntax::Methods

# Add more helper methods to be used by all tests here...
end

class ActionController::TestCase
include Devise::TestHelpers
include FactoryGirl::Syntax::Methods
end

0 comments on commit 6be7275

Please sign in to comment.