Permalink
Browse files

install rspec, guard, etc.. and add some specs (need alot more)

  • Loading branch information...
johnmcaliley committed Mar 7, 2012
1 parent bc70c89 commit 6236daf4d1f34fdead202337f3b805cf3d1f91b3
Showing with 67 additions and 116 deletions.
  1. +1 −0 .gitignore
  2. +0 −99 Gemfile.lock
  3. +7 −0 Guardfile
  4. +7 −0 rapid_transit.gemspec
  5. 0 {test → spec}/dummy/Rakefile
  6. 0 {test → spec}/dummy/app/assets/javascripts/application.js
  7. 0 {test → spec}/dummy/app/assets/stylesheets/application.css
  8. 0 {test → spec}/dummy/app/controllers/application_controller.rb
  9. 0 {test → spec}/dummy/app/helpers/application_helper.rb
  10. 0 {test → spec}/dummy/app/mailers/.gitkeep
  11. 0 {test → spec}/dummy/app/models/.gitkeep
  12. 0 {test → spec}/dummy/app/views/layouts/application.html.erb
  13. 0 {test → spec}/dummy/config.ru
  14. 0 {test → spec}/dummy/config/application.rb
  15. 0 {test → spec}/dummy/config/boot.rb
  16. 0 {test → spec}/dummy/config/database.yml
  17. 0 {test → spec}/dummy/config/environment.rb
  18. 0 {test → spec}/dummy/config/environments/development.rb
  19. 0 {test → spec}/dummy/config/environments/production.rb
  20. 0 {test → spec}/dummy/config/environments/test.rb
  21. 0 {test → spec}/dummy/config/initializers/backtrace_silencers.rb
  22. 0 {test → spec}/dummy/config/initializers/inflections.rb
  23. 0 {test → spec}/dummy/config/initializers/mime_types.rb
  24. 0 {test → spec}/dummy/config/initializers/secret_token.rb
  25. 0 {test → spec}/dummy/config/initializers/session_store.rb
  26. 0 {test → spec}/dummy/config/initializers/wrap_parameters.rb
  27. 0 {test → spec}/dummy/config/locales/en.yml
  28. 0 {test → spec}/dummy/config/routes.rb
  29. 0 test/dummy/lib/assets/.gitkeep → spec/dummy/db/test.sqlite3
  30. 0 {test/dummy/log → spec/dummy/lib/assets}/.gitkeep
  31. 0 test/dummy/public/favicon.ico → spec/dummy/log/.gitkeep
  32. 0 spec/dummy/log/test.log
  33. 0 {test → spec}/dummy/public/404.html
  34. 0 {test → spec}/dummy/public/422.html
  35. 0 {test → spec}/dummy/public/500.html
  36. 0 spec/dummy/public/favicon.ico
  37. 0 {test → spec}/dummy/script/rails
  38. 0 spec/factories.rb
  39. +17 −0 spec/spec_helper.rb
  40. +35 −0 spec/unit/base_spec.rb
  41. +0 −7 test/rapid_transit_test.rb
  42. +0 −10 test/test_helper.rb
View
@@ -5,3 +5,4 @@ test/dummy/db/*.sqlite3
test/dummy/log/*.log
test/dummy/tmp/
Gemfile.lock
+coverage/*
View
@@ -1,99 +0,0 @@
-PATH
- remote: .
- specs:
- rapid_transit (0.0.1)
- rails (~> 3.1.3)
-
-GEM
- remote: http://rubygems.org/
- specs:
- actionmailer (3.1.3)
- actionpack (= 3.1.3)
- mail (~> 2.3.0)
- actionpack (3.1.3)
- activemodel (= 3.1.3)
- activesupport (= 3.1.3)
- builder (~> 3.0.0)
- erubis (~> 2.7.0)
- i18n (~> 0.6)
- rack (~> 1.3.5)
- rack-cache (~> 1.1)
- rack-mount (~> 0.8.2)
- rack-test (~> 0.6.1)
- sprockets (~> 2.0.3)
- activemodel (3.1.3)
- activesupport (= 3.1.3)
- builder (~> 3.0.0)
- i18n (~> 0.6)
- activerecord (3.1.3)
- activemodel (= 3.1.3)
- activesupport (= 3.1.3)
- arel (~> 2.2.1)
- tzinfo (~> 0.3.29)
- activeresource (3.1.3)
- activemodel (= 3.1.3)
- activesupport (= 3.1.3)
- activesupport (3.1.3)
- multi_json (~> 1.0)
- arel (2.2.1)
- builder (3.0.0)
- erubis (2.7.0)
- hike (1.2.1)
- i18n (0.6.0)
- jquery-rails (1.0.19)
- railties (~> 3.0)
- thor (~> 0.14)
- json (1.6.5)
- mail (2.3.0)
- i18n (>= 0.4.0)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- mime-types (1.17.2)
- multi_json (1.0.4)
- polyglot (0.3.3)
- rack (1.3.6)
- rack-cache (1.1)
- rack (>= 0.4)
- rack-mount (0.8.3)
- rack (>= 1.0.0)
- rack-ssl (1.3.2)
- rack
- rack-test (0.6.1)
- rack (>= 1.0)
- rails (3.1.3)
- actionmailer (= 3.1.3)
- actionpack (= 3.1.3)
- activerecord (= 3.1.3)
- activeresource (= 3.1.3)
- activesupport (= 3.1.3)
- bundler (~> 1.0)
- railties (= 3.1.3)
- railties (3.1.3)
- actionpack (= 3.1.3)
- activesupport (= 3.1.3)
- rack-ssl (~> 1.3.2)
- rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (~> 0.14.6)
- rake (0.9.2.2)
- rdoc (3.12)
- json (~> 1.4)
- sprockets (2.0.3)
- hike (~> 1.2)
- rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
- sqlite3 (1.3.5)
- thor (0.14.6)
- tilt (1.3.3)
- treetop (1.4.10)
- polyglot
- polyglot (>= 0.3.1)
- tzinfo (0.3.31)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- jquery-rails
- rapid_transit!
- sqlite3
View
@@ -0,0 +1,7 @@
+group 'rspec' do
+ guard 'rspec' do
+ watch('spec/spec_helper.rb') { "spec" }
+ watch(%r{^spec/.+_spec\.rb})
+ watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
+ end
+end
View
@@ -19,4 +19,11 @@ Gem::Specification.new do |s|
s.add_dependency "rails", ">= 2.3.8"
s.add_development_dependency "sqlite3"
+ s.add_development_dependency 'factory_girl'
+ s.add_development_dependency 'rspec-rails'
+ s.add_development_dependency 'guard-rspec'
+ s.add_development_dependency 'growl'
+ s.add_development_dependency 'shoulda-matchers'
+ s.add_development_dependency 'launchy'
+ s.add_development_dependency 'simplecov'
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
No changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
No changes.
File renamed without changes.
View
No changes.
View
@@ -0,0 +1,17 @@
+require 'simplecov'
+SimpleCov.start
+
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+ENV["RAILS_ENV"] ||= 'test'
+require File.expand_path('../dummy/config/environment', __FILE__)
+require 'rspec/rails'
+require 'rspec/autorun'
+#require 'ostruct'
+
+Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+
+RSpec.configure do |config|
+ config.mock_with :rspec
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+ config.use_transactional_fixtures = true
+end
View
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe RapidTransit::Base do
+ it "returns default delimiter if not set explicitly" do
+ RapidTransit::Base.delimiter.should eq ","
+ end
+
+ it "sets the delimeter" do
+ RapidTransit::Base.delimit("|")
+ RapidTransit::Base.delimiter.should eq "|"
+ end
+
+ it "returns true for strip if not set" do
+ RapidTransit::Base.strip.should be true
+ end
+
+ it "sets the strip class var" do
+ RapidTransit::Base.strip_columns(false)
+ RapidTransit::Base.strip.should eq false
+ RapidTransit::Base.strip_columns(true)
+ RapidTransit::Base.strip.should be true
+ end
+
+ it "raises argerror on_error without block" do
+ expect { RapidTransit::Base.on_error }.should raise_error
+ end
+
+ it "raises argerror on_error if block arity is not 2" do
+ expect { RapidTransit::Base.on_error {|test| puts "test" }}.should raise_error
+ end
+
+ it "does not raise error on_error if block arity is 2" do
+ expect { RapidTransit::Base.on_error {|test, test2| puts "test" }}.should_not raise_error
+ end
+end
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class RapidTransitTest < ActiveSupport::TestCase
- test "truth" do
- assert_kind_of Module, RapidTransit
- end
-end
View
@@ -1,10 +0,0 @@
-# Configure Rails Environment
-ENV["RAILS_ENV"] = "test"
-
-require File.expand_path("../dummy/config/environment.rb", __FILE__)
-require "rails/test_help"
-
-Rails.backtrace_cleaner.remove_silencers!
-
-# Load support files
-Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

0 comments on commit 6236daf

Please sign in to comment.