Skip to content

Commit

Permalink
added rspec+capybara and wrote events spec
Browse files Browse the repository at this point in the history
  • Loading branch information
nrevko committed Jan 27, 2012
1 parent 0e460b8 commit 9f48049
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 0 deletions.
1 change: 1 addition & 0 deletions .rspec
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
--colour
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ gem 'jquery-rails'
# To use debugger # To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug' # gem 'ruby-debug19', :require => 'ruby-debug'


group :development, :test do
gem 'rspec-rails'
gem 'capybara'
gem 'launchy'
gem 'database_cleaner'
end
41 changes: 41 additions & 0 deletions Gemfile.lock
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,35 +29,51 @@ GEM
activesupport (= 3.1.3) activesupport (= 3.1.3)
activesupport (3.1.3) activesupport (3.1.3)
multi_json (~> 1.0) multi_json (~> 1.0)
addressable (2.2.6)
arel (2.2.1) arel (2.2.1)
bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1)
builder (3.0.0) 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-rails (3.1.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (~> 3.1.0) railties (~> 3.1.0)
coffee-script (2.2.0) coffee-script (2.2.0)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.2.0) coffee-script-source (1.2.0)
database_cleaner (0.7.1)
devise (1.5.3) devise (1.5.3)
bcrypt-ruby (~> 3.0) bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3) orm_adapter (~> 0.0.3)
warden (~> 1.1) warden (~> 1.1)
diff-lcs (1.1.3)
erubis (2.7.0) erubis (2.7.0)
execjs (1.2.13) execjs (1.2.13)
multi_json (~> 1.0) multi_json (~> 1.0)
ffi (1.0.11)
hike (1.2.1) hike (1.2.1)
i18n (0.6.0) i18n (0.6.0)
jquery-rails (1.0.19) jquery-rails (1.0.19)
railties (~> 3.0) railties (~> 3.0)
thor (~> 0.14) thor (~> 0.14)
json (1.6.5) json (1.6.5)
launchy (2.0.5)
addressable (~> 2.2.6)
mail (2.3.0) mail (2.3.0)
i18n (>= 0.4.0) i18n (>= 0.4.0)
mime-types (~> 1.16) mime-types (~> 1.16)
treetop (~> 1.4.8) treetop (~> 1.4.8)
mime-types (1.17.2) mime-types (1.17.2)
multi_json (1.0.4) multi_json (1.0.4)
nokogiri (1.5.0)
orm_adapter (0.0.6) orm_adapter (0.0.6)
polyglot (0.3.3) polyglot (0.3.3)
rack (1.3.6) rack (1.3.6)
Expand Down Expand Up @@ -87,12 +103,31 @@ GEM
rake (0.9.2.2) rake (0.9.2.2)
rdoc (3.12) rdoc (3.12)
json (~> 1.4) 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 (3.1.12)
sass-rails (3.1.5) sass-rails (3.1.5)
actionpack (~> 3.1.0) actionpack (~> 3.1.0)
railties (~> 3.1.0) railties (~> 3.1.0)
sass (~> 3.1.10) sass (~> 3.1.10)
tilt (~> 1.3.2) 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) sprockets (2.0.3)
hike (~> 1.2) hike (~> 1.2)
rack (~> 1.0) rack (~> 1.0)
Expand All @@ -109,15 +144,21 @@ GEM
multi_json (>= 1.0.2) multi_json (>= 1.0.2)
warden (1.1.0) warden (1.1.0)
rack (>= 1.0) rack (>= 1.0)
xpath (0.1.4)
nokogiri (~> 1.3)


PLATFORMS PLATFORMS
ruby ruby


DEPENDENCIES DEPENDENCIES
capybara
coffee-rails (~> 3.1.1) coffee-rails (~> 3.1.1)
database_cleaner
devise devise
jquery-rails jquery-rails
launchy
rails (= 3.1.3) rails (= 3.1.3)
rspec-rails
sass-rails (~> 3.1.5) sass-rails (~> 3.1.5)
sqlite3 sqlite3
uglifier (>= 1.0.3) uglifier (>= 1.0.3)
23 changes: 23 additions & 0 deletions spec/requests/events_spec.rb
Original file line number Original file line Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions spec/spec_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -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

0 comments on commit 9f48049

Please sign in to comment.