Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added rspec+capybara and wrote events spec

  • Loading branch information...
commit 9f48049c8c1aa7622674ce3f24248daedf2a7eca 1 parent 0e460b8
@nrevko nrevko authored
View
1  .rspec
@@ -0,0 +1 @@
+--colour
View
6 Gemfile
@@ -30,3 +30,9 @@ gem 'jquery-rails'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
+group :development, :test do
+ gem 'rspec-rails'
+ gem 'capybara'
+ gem 'launchy'
+ gem 'database_cleaner'
+end
View
41 Gemfile.lock
@@ -29,9 +29,19 @@ GEM
activesupport (= 3.1.3)
activesupport (3.1.3)
multi_json (~> 1.0)
+ addressable (2.2.6)
arel (2.2.1)
bcrypt-ruby (3.0.1)
builder (3.0.0)
+ capybara (1.1.2)
+ 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.3.0)
+ ffi (~> 1.0.6)
coffee-rails (3.1.1)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
@@ -39,25 +49,31 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.2.0)
+ database_cleaner (0.7.1)
devise (1.5.3)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.1)
+ diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.2.13)
multi_json (~> 1.0)
+ ffi (1.0.11)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.19)
railties (~> 3.0)
thor (~> 0.14)
json (1.6.5)
+ launchy (2.0.5)
+ addressable (~> 2.2.6)
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)
+ nokogiri (1.5.0)
orm_adapter (0.0.6)
polyglot (0.3.3)
rack (1.3.6)
@@ -87,12 +103,31 @@ GEM
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.8.0)
+ rspec-rails (2.8.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.8.0)
+ rubyzip (0.9.5)
sass (3.1.12)
sass-rails (3.1.5)
actionpack (~> 3.1.0)
railties (~> 3.1.0)
sass (~> 3.1.10)
tilt (~> 1.3.2)
+ selenium-webdriver (2.17.0)
+ childprocess (>= 0.2.5)
+ ffi (~> 1.0.9)
+ multi_json (~> 1.0.4)
+ rubyzip
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
@@ -109,15 +144,21 @@ GEM
multi_json (>= 1.0.2)
warden (1.1.0)
rack (>= 1.0)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
+ capybara
coffee-rails (~> 3.1.1)
+ database_cleaner
devise
jquery-rails
+ launchy
rails (= 3.1.3)
+ rspec-rails
sass-rails (~> 3.1.5)
sqlite3
uglifier (>= 1.0.3)
View
23 spec/requests/events_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe "Events" do
+
+ it "should create a new event" do
+ # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
+ visit events_path
+ click_link "New Event"
+
+ fill_in "Title", :with=>"February Event"
+ select "February",:from =>"event[date(2i)]"
+ click_button "Create Event"
+
+ page.should have_content("February Event")
+ page.should have_content("This event currently has no location!")
+
+ visit events_path
+
+ page.should have_content("February Event")
+
+ end
+
+end
View
42 spec/spec_helper.rb
@@ -0,0 +1,42 @@
+# 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 'rspec/autorun'
+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
+
+ # 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 = false
+
+ config.before(:suite) do
+ DatabaseCleaner.strategy = :truncation
+ end
+
+ config.before(:each) do
+ DatabaseCleaner.start
+ end
+
+ config.after(:each) do
+ DatabaseCleaner.clean
+ end
+
+ # If true, the base class of anonymous controllers will be inferred
+ # automatically. This will be the default behavior in future versions of
+ # rspec-rails.
+ #config.infer_base_class_for_anonymous_controllers = false
+end
Please sign in to comment.
Something went wrong with that request. Please try again.