Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Capybara 2 #206

Merged
merged 1 commit into from
Mar 23, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
before_install:
- echo "yes" | gem uninstall json
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
script:
- bundle
- rake appraisal:install
Expand Down
4 changes: 2 additions & 2 deletions features/config_project_name.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature:
"""

When I open the coverage report generated with `bundle exec rake test`
Then I should see "Code coverage for Project"
Then I should see "Code coverage for Project" within "title"

Scenario: Custom name
Given SimpleCov for Test/Unit is configured with:
Expand All @@ -24,4 +24,4 @@ Feature:
"""

When I open the coverage report generated with `bundle exec rake test`
Then I should see "Code coverage for Superfancy 2.0"
Then I should see "Code coverage for Superfancy 2.0" within "title"
2 changes: 1 addition & 1 deletion features/step_definitions/html_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def available_source_files
expected_files.length.should == available_source_files.count

# Find all filenames and their coverage present in coverage report
files = available_source_files.map {|f| {"name" => f.find('h3').text, "coverage" => f.find('.header span').text} }
files = available_source_files.map {|f| {"name" => f.find('h3').text, "coverage" => f.find('h4 > span').text} }

files.sort_by {|hsh| hsh["name"] }.should == expected_files.sort_by {|hsh| hsh["name"] }
end
Expand Down
11 changes: 9 additions & 2 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@
Bundler.setup
require 'aruba/cucumber'
require 'capybara/cucumber'
require 'capybara/webkit'

# Fake rack app for capybara that just returns the latest coverage report from aruba temp project dir
Capybara.app = lambda {|env|
Capybara.app = lambda { |env|
request_path = env['REQUEST_PATH'] || '/'
request_path = '/index.html' if request_path == '/'

[200, {'Content-Type' => 'text/html'},
[File.read(File.join(File.dirname(__FILE__), '../../tmp/aruba/project', 'coverage/index.html'))]]
[File.read(File.join(File.dirname(__FILE__), '../../tmp/aruba/project/coverage', request_path))]]
}

# https://github.com/thoughtbot/capybara-webkit
Capybara.default_driver = Capybara.javascript_driver = :webkit

Before do
@aruba_timeout_seconds = 20
this_dir = File.dirname(__FILE__)
Expand Down
3 changes: 2 additions & 1 deletion simplecov.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Gem::Specification.new do |gem|
gem.add_dependency 'simplecov-html', '~> 0.7.1'

gem.add_development_dependency 'aruba'
gem.add_development_dependency 'capybara', '~> 1.0'
gem.add_development_dependency 'capybara', '~> 2.0'
gem.add_development_dependency 'capybara-webkit'
gem.add_development_dependency 'appraisal'
gem.add_development_dependency 'cucumber', '>= 1.1.4'
gem.add_development_dependency 'rake'
Expand Down