Skip to content

Commit

Permalink
Switch to capybara-webkit
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-burns committed Jul 27, 2012
1 parent ab750eb commit 41eeb4f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Gemfile.lock
Expand Up @@ -60,6 +60,9 @@ GEM
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
capybara-webkit (0.11.0)
capybara (>= 1.0.0, < 1.2)
json
childprocess (0.3.2)
ffi (~> 1.0.6)
cocaine (0.2.1)
Expand Down Expand Up @@ -190,6 +193,7 @@ DEPENDENCIES
bourne
bundler
capybara
capybara-webkit
cocaine (~> 0.2)
cucumber (~> 1.2.1)
fakeweb
Expand Down
5 changes: 5 additions & 0 deletions features/step_definitions/rails_steps.rb
@@ -1,4 +1,8 @@
Given /^I generate a new rails application$/ do
in_current_dir do
FileUtils.rm_rf(APP_NAME)
end

steps %{
When I run `bundle exec #{new_application_command} #{APP_NAME} --skip-bundle`
And I cd to "#{APP_NAME}"
Expand All @@ -14,6 +18,7 @@
gem "gherkin"
gem "aws-sdk"
gem 'thin'
gem 'jquery-rails'
"""
And I configure the application to use "paperclip" from this project
And I reset Bundler environment variable
Expand Down
8 changes: 5 additions & 3 deletions features/step_definitions/regnerating_styles_steps.rb
Expand Up @@ -26,12 +26,14 @@ class User < ActiveRecord::Base
FakeWeb.allow_net_connect = true
in_current_dir { RailsServer.start_unless_started(ENV['PORT'], ENV['DEBUG']) }

Capybara.current_driver = :selenium
require 'capybara/webkit'
Capybara.current_driver = :webkit
Capybara.app_host = RailsServer.app_host

visit '/users/new'
attach_file('Avatar', File.expand_path('test/fixtures/5k.png'))
click_button 'Submit'
sleep 1
end

When /^I add the following style to the user avatar:$/ do |string|
Expand All @@ -53,7 +55,7 @@ class User < ActiveRecord::Base
visit '/users'
click_link 'Show'

page.source =~ %r{img src="/([^"]+large[^"]+)\?.*"}
page.source =~ %r{img.*src="/([^"]+large[^"]+)\?.*"}
image_path = $1
image_path.should_not be_blank

Expand Down Expand Up @@ -92,7 +94,7 @@ class #{migration_name.classify} < ActiveRecord::Migration
visit '/users'
click_link 'Show'

page.source =~ %r{img src="/([^"]+large[^"]+)\?.*"}
page.source =~ %r{img.*src="/([^"]+large[^"]+)\?.*"}
image_path = $1
image_path.should_not be_blank

Expand Down
1 change: 1 addition & 0 deletions paperclip.gemspec
Expand Up @@ -51,4 +51,5 @@ Gem::Specification.new do |s|
s.add_development_dependency('railties')
s.add_development_dependency('actionmailer')
s.add_development_dependency('thin')
s.add_development_dependency('capybara-webkit')
end

0 comments on commit 41eeb4f

Please sign in to comment.