Merge branch 'master' into home
This commit is contained in:
@@ -19,13 +19,15 @@ feature 'Comments' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Create' do
|
||||
scenario 'Create', :js do
|
||||
user = create(:user)
|
||||
debate = create(:debate)
|
||||
|
||||
login_as(user)
|
||||
visit debate_path(debate)
|
||||
|
||||
click_on 'Comentar'
|
||||
|
||||
fill_in 'comment_body', with: '¿Has pensado en esto...?'
|
||||
click_button 'Publicar comentario'
|
||||
|
||||
@@ -36,7 +38,7 @@ feature 'Comments' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Reply' do
|
||||
scenario 'Reply', :js do
|
||||
citizen = create(:user, first_name: 'Ana')
|
||||
manuela = create(:user, first_name: 'Manuela')
|
||||
debate = create(:debate)
|
||||
@@ -45,9 +47,10 @@ feature 'Comments' do
|
||||
login_as(manuela)
|
||||
visit debate_path(debate)
|
||||
|
||||
within "#comment-#{comment.id}" do
|
||||
click_link "Responder"
|
||||
within "#js-comment-form-comment_#{comment.id}" do
|
||||
fill_in 'comment_body', with: 'La semana que viene está hecho.'
|
||||
click_button 'Publicar comentario'
|
||||
click_button 'Publicar respuesta'
|
||||
end
|
||||
|
||||
expect(page).to have_content 'Comentario guardado'
|
||||
|
||||
@@ -2,10 +2,11 @@ ENV['RAILS_ENV'] ||= 'test'
|
||||
require File.expand_path('../../config/environment', __FILE__)
|
||||
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
||||
|
||||
require 'spec_helper'
|
||||
require 'rspec/rails'
|
||||
require 'spec_helper'
|
||||
require 'capybara/rails'
|
||||
require 'capybara/rspec'
|
||||
require 'capybara/poltergeist'
|
||||
|
||||
include Warden::Test::Helpers
|
||||
Warden.test_mode!
|
||||
@@ -13,6 +14,7 @@ Warden.test_mode!
|
||||
ActiveRecord::Migration.maintain_test_schema!
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.use_transactional_fixtures = true
|
||||
config.infer_spec_type_from_file_location!
|
||||
end
|
||||
end
|
||||
|
||||
Capybara.javascript_driver = :poltergeist
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
require 'factory_girl_rails'
|
||||
require 'database_cleaner'
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.use_transactional_fixtures = false
|
||||
|
||||
config.filter_run :focus
|
||||
config.run_all_when_everything_filtered = true
|
||||
config.include FactoryGirl::Syntax::Methods
|
||||
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.clean_with :truncation
|
||||
end
|
||||
|
||||
config.before(:each) do |example|
|
||||
DatabaseCleaner.strategy= example.metadata[:js] ? :truncation : :transaction
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
config.after(:each) do
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
|
||||
# Allows RSpec to persist some state between runs in order to support
|
||||
# the `--only-failures` and `--next-failure` CLI options.
|
||||
config.example_status_persistence_file_path = "spec/examples.txt"
|
||||
|
||||
Reference in New Issue
Block a user