Skip to content
Browse files

Replaced capybara-webkit with poltergeist to get better support for T…

…ravis. It was not without cons though, had to set some values in the spec with jquery since poltergeist gave me all sorts of trouble.
  • Loading branch information...
1 parent b8dbf69 commit bd14276d0f5262ea5271537566088753de2e2c38 @fbfactory fbfactory committed with mshibuya May 8, 2013
Showing with 13 additions and 7 deletions.
  1. +0 −1 .travis.yml
  2. +2 −1 Gemfile
  3. +8 −4 spec/integration/config/edit/rails_admin_config_edit_spec.rb
  4. +3 −1 spec/spec_helper.rb
View
1 .travis.yml
@@ -28,6 +28,5 @@ before_script:
- bundle install
- bundle exec rake rails_admin:prepare_ci_env db:create db:migrate
- cd ../../
-script: xvfb-run rspec
services:
- mongodb
View
3 Gemfile
@@ -55,7 +55,8 @@ group :test do
gem 'simplecov', :require => false
gem 'strong_parameters', '>= 0.1.6'
gem 'timecop', '>= 0.5'
- gem 'capybara-webkit'
+ gem 'faye-websocket', '0.4.4'
+ gem 'poltergeist', '~> 1.0.2'
end
gemspec
View
12 spec/integration/config/edit/rails_admin_config_edit_spec.rb
@@ -699,17 +699,21 @@ class HelpTest < Tableless
page.find('#field_test_comment_attributes_field .add_nested_fields').click()
fill_in "field_test_comment_attributes_content", :with => 'nested comment content'
+
+ # Poltergeist fails to set the value of the invisible elements, have to do it with jquery
+ page.execute_script('$("#field_test_nested_field_tests_attributes_0_title").val("nested field test title 1 edited")')
+ page.execute_script('$("#field_test_nested_field_tests_attributes_1__destroy").val("true")')
- fill_in "field_test_nested_field_tests_attributes_0_title", :with => 'nested field test title 1 edited'
- page.find('#field_test_nested_field_tests_attributes_1__destroy').set('true')
+ #fill_in "field_test_nested_field_tests_attributes_0_title", :with => 'nested field test title 1 edited'
+ #page.find('#field_test_nested_field_tests_attributes_1__destroy').set('true')
click_button "Save" # first(:button, "Save").click
@record.reload
- sleep 1 # Without the sleep, the nested attributes are not loaded yet when the subsequent asserts are executed.
+ #sleep 1 # Without the sleep, the nested attributes are not loaded yet when the subsequent asserts are executed.
- expect(@record.comment.content).to eq('nested comment content')
+ expect(@record.comment.content.strip).to eq('nested comment content')
expect(@record.nested_field_tests.length).to eq(1)
expect(@record.nested_field_tests[0].title).to eq('nested field test title 1 edited')
end
View
4 spec/spec_helper.rb
@@ -49,6 +49,8 @@ def password_digest(password)
config.stretches = 0
end
+require 'capybara/poltergeist'
+
RSpec.configure do |config|
config.expect_with :rspec do |c|
c.syntax = :expect
@@ -93,5 +95,5 @@ def password_digest(password)
end
end
- Capybara.javascript_driver = :webkit
+ Capybara.javascript_driver = :poltergeist
end

0 comments on commit bd14276

Please sign in to comment.
Something went wrong with that request. Please try again.