* VRFS-312 fixed change of password_validation parameter to current_parameter in tests

This commit is contained in:
Seth Call 2013-05-14 20:26:27 -05:00
parent 85da9ef643
commit 64b3d8f15c
4 changed files with 41 additions and 2 deletions

View File

@ -0,0 +1,26 @@
require 'spec_helper'
describe "Account", :js => true, :type => :feature, :capybara_feature => true do
=begin
subject { page }
before(:all) do
Capybara.javascript_driver = :poltergeist
Capybara.current_driver = Capybara.javascript_driver
end
before(:each) do
UserMailer.deliveries.clear
sign_in_poltergeist user
visit "/client#/account"
puts page.html
end
let(:user) { FactoryGirl.create(:user) }
it { should have_selector('h1', text: 'my account') }
=end
end

View File

@ -246,7 +246,7 @@ describe "User API", :type => :api do
#################### ACCOUNT SETTINGS ###########################
def begin_update_email(authenticated_user, update_email, validation_password, login = true)
login(authenticated_user.email, authenticated_user.password, 200, true) if login
post "/api/users/#{authenticated_user.id}/update_email.json", { :update_email => update_email, :password_validation => validation_password }.to_json, "CONTENT_TYPE" => 'application/json'
post "/api/users/#{authenticated_user.id}/update_email.json", { :update_email => update_email, :current_password => validation_password }.to_json, "CONTENT_TYPE" => 'application/json'
return last_response
end
@ -931,7 +931,7 @@ describe "User API", :type => :api do
it "bad user" do
login(user.email, user.password, 200, true)
post "/api/users/someone_other_uuid/update_email.json", { :update_email => "not_taken_test@jamkazam.com", :password_validation => user.password}.to_json, "CONTENT_TYPE" => 'application/json'
post "/api/users/someone_other_uuid/update_email.json", { :update_email => "not_taken_test@jamkazam.com", :current_password => user.password}.to_json, "CONTENT_TYPE" => 'application/json'
last_response.status.should == 403
UserMailer.deliveries.length.should == 0
end

View File

@ -37,6 +37,11 @@ Spork.prefork do
require 'capybara'
require 'capybara/rspec'
require 'capybara/poltergeist'
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, { phantomjs_logger: 'log/phantomjs.out' })
end
Capybara.javascript_driver = :poltergeist
if defined?(TEST_CONNECT_STATES) && TEST_CONNECT_STATES
require 'capybara/poltergeist'

View File

@ -11,4 +11,12 @@ def sign_in(user)
click_button "SIGN IN"
# Sign in when not using Capybara as well.
cookie_jar[:remember_token] = user.remember_token
end
def sign_in_poltergeist(user)
visit signin_path
fill_in "Email", with: user.email
fill_in "Password", with: user.password
click_button "SIGN IN"
end