Skip to content

Commit

Permalink
can create zombies
Browse files Browse the repository at this point in the history
  • Loading branch information
ecavazos committed Mar 17, 2012
1 parent fc6d76f commit 4d1252b
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 21 deletions.
8 changes: 8 additions & 0 deletions Gemfile
Expand Up @@ -29,6 +29,14 @@ group :development, :test do
gem 'capybara'
gem 'rspec-rails'
end

group :test do
gem 'factory_girl_rails'
gem 'factory_girl_extensions'
gem 'launchy'
gem 'database_cleaner'
end

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

Expand Down
15 changes: 15 additions & 0 deletions Gemfile.lock
Expand Up @@ -28,6 +28,7 @@ GEM
activesupport (3.2.2)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.7)
arel (3.0.2)
builder (3.0.0)
capybara (1.1.2)
Expand All @@ -46,10 +47,18 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.2.0)
database_cleaner (0.7.1)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.3.0)
multi_json (~> 1.0)
factory_girl (2.1.2)
activesupport
factory_girl_extensions (0.3.4)
factory_girl (> 0.0.0)
factory_girl_rails (1.2.0)
factory_girl (~> 2.1.0)
railties (>= 3.0.0)
ffi (1.0.11)
haml (3.1.4)
hike (1.2.1)
Expand All @@ -59,6 +68,8 @@ GEM
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.6.5)
launchy (2.0.5)
addressable (~> 2.2.6)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
Expand Down Expand Up @@ -139,9 +150,13 @@ PLATFORMS
DEPENDENCIES
capybara
coffee-rails (~> 3.2.1)
database_cleaner
factory_girl_extensions
factory_girl_rails
haml
jquery-rails
json
launchy
rails (= 3.2.2)
rspec-rails
sass-rails (~> 3.2.3)
Expand Down
14 changes: 0 additions & 14 deletions app/views/layouts/application.html.erb

This file was deleted.

2 changes: 2 additions & 0 deletions config/routes.rb
@@ -1,4 +1,6 @@
SuperZombies::Application.routes.draw do
resources :zombies

root :to => 'welcome#index'
# The priority is based upon order of creation:
# first created -> highest priority.
Expand Down
3 changes: 2 additions & 1 deletion feadback.markdown
Expand Up @@ -2,4 +2,5 @@

* The scenario about the homepage should go before the auth scenario
- Having a page to secure makes it easier to test drive the auth in
*

* Provide code snippets or hints (depends on what we expect for candidates)
3 changes: 0 additions & 3 deletions spec/requests/welcome_spec.rb
Expand Up @@ -2,9 +2,6 @@

describe 'Welcome (aka Homepage)', :js => true do

before do
end

it 'should be ze homepage' do
visit root_path
find('h1').should have_content('Welcome to the Super Zombies website')
Expand Down
23 changes: 20 additions & 3 deletions spec/spec_helper.rb
Expand Up @@ -13,12 +13,29 @@

RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
config.use_transactional_fixtures = false # If set to true it makes selenium + sqlite sad :(
config.infer_base_class_for_anonymous_controllers = false

config.before :each do
port = page.driver.rack_server.port
Capybara.app_host = "http://test:test@127.0.0.1:#{ port }"
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.start

# Selenium hates http basic auth so this bit of horrible code
# is my attempt to work around that.
# I only do this for request specs
if example.metadata[:type] == :request
ApplicationController.class_eval do
def authenticate_or_request_with_http_basic(realm = "Application", &login_procedure)
user, pass = 'test', 'test'
login_procedure.call([user, pass])
end
end
end
end

config.after :each do
DatabaseCleaner.clean
Rails.cache.clear
end

end

0 comments on commit 4d1252b

Please sign in to comment.