diff options
author | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2011-05-09 13:29:41 +0200 |
---|---|---|
committer | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2011-05-10 11:18:10 +0200 |
commit | f940252f3d92877d6d3b6808c14bea9f1a564cc7 (patch) | |
tree | 95ab0d08045c6cc2350a5a2e2a03adca61f2c8a8 | |
parent | A plain hobo application (diff) | |
download | council-webapp-f940252f3d92877d6d3b6808c14bea9f1a564cc7.tar.gz council-webapp-f940252f3d92877d6d3b6808c14bea9f1a564cc7.tar.bz2 council-webapp-f940252f3d92877d6d3b6808c14bea9f1a564cc7.zip |
A working rspec test
-rw-r--r-- | site/.rspec | 1 | ||||
-rw-r--r-- | site/Gemfile | 6 | ||||
-rw-r--r-- | site/Gemfile.lock | 25 | ||||
-rw-r--r-- | site/spec/models/user_spec.rb | 7 | ||||
-rw-r--r-- | site/spec/spec_helper.rb | 15 |
5 files changed, 54 insertions, 0 deletions
diff --git a/site/.rspec b/site/.rspec new file mode 100644 index 0000000..53607ea --- /dev/null +++ b/site/.rspec @@ -0,0 +1 @@ +--colour diff --git a/site/Gemfile b/site/Gemfile index 9897314..7bac170 100644 --- a/site/Gemfile +++ b/site/Gemfile @@ -2,4 +2,10 @@ source 'http://rubygems.org' gem 'rails', '3.0.3' gem 'sqlite3-ruby', :require => 'sqlite3' +group :development, :test do + gem 'ruby-debug' + gem 'rspec-rails' + gem 'shoulda' +end + gem "hobo", ">= 1.3.0.pre28" diff --git a/site/Gemfile.lock b/site/Gemfile.lock index 11cd8dd..94fd74f 100644 --- a/site/Gemfile.lock +++ b/site/Gemfile.lock @@ -30,6 +30,8 @@ GEM activesupport (3.0.3) arel (2.0.9) builder (3.0.0) + columnize (0.3.2) + diff-lcs (1.1.2) dryml (1.3.0.pre28) actionpack (>= 3.0.0) hobo_support (= 1.3.0.pre28) @@ -47,6 +49,7 @@ GEM hobo_support (1.3.0.pre28) rails (>= 3.0.0) i18n (0.5.0) + linecache (0.43) mail (2.2.15) activesupport (>= 2.3.6) i18n (>= 0.4.0) @@ -73,6 +76,25 @@ GEM rake (>= 0.8.7) thor (~> 0.14.4) rake (0.8.7) + rspec (2.5.0) + rspec-core (~> 2.5.0) + rspec-expectations (~> 2.5.0) + rspec-mocks (~> 2.5.0) + rspec-core (2.5.1) + rspec-expectations (2.5.0) + diff-lcs (~> 1.1.2) + rspec-mocks (2.5.0) + rspec-rails (2.5.0) + actionpack (~> 3.0) + activesupport (~> 3.0) + railties (~> 3.0) + rspec (~> 2.5.0) + ruby-debug (0.10.4) + columnize (>= 0.1) + ruby-debug-base (~> 0.10.4.0) + ruby-debug-base (0.10.4) + linecache (>= 0.3) + shoulda (2.11.3) sqlite3 (1.3.3) sqlite3-ruby (1.3.3) sqlite3 (>= 1.3.3) @@ -88,4 +110,7 @@ PLATFORMS DEPENDENCIES hobo (>= 1.3.0.pre28) rails (= 3.0.3) + rspec-rails + ruby-debug + shoulda sqlite3-ruby diff --git a/site/spec/models/user_spec.rb b/site/spec/models/user_spec.rb new file mode 100644 index 0000000..05254c8 --- /dev/null +++ b/site/spec/models/user_spec.rb @@ -0,0 +1,7 @@ +require 'spec_helper.rb' + +describe User do + it "should run spec test with shoulda and models from application" do + Guest.new.should_not be_administrator + end +end diff --git a/site/spec/spec_helper.rb b/site/spec/spec_helper.rb new file mode 100644 index 0000000..20a45b7 --- /dev/null +++ b/site/spec/spec_helper.rb @@ -0,0 +1,15 @@ +ENV["RAILS_ENV"] ||= 'test' +require File.expand_path("../../config/environment", __FILE__) +require 'rspec/rails' + +RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) +environment_path = File.expand_path(File.join(RAILS_ROOT, 'config', 'environment')) +require(environment_path) + +# 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| + config.mock_with :rspec +end |