2

テストを実行すると、JavaScriptが実行されません。:seleniumドライバーから:webkitドライバーに切り替えてみましたが、それでもうまくいきませんでした。

ブラウザでは正常に動作します。テストが実行されてページが開くと、ページは空白になります

テスト実行中にjavascriptを実行するために他に何かする必要がありますか?

business_integration_test.rb

require 'minitest_helper'
require 'ruby-debug'

describe "Business integration" do

  before :each do
    @business = Factory.build(:business)
    Capybara.javascript_driver = :webkit
  end

  it "Should show error if business name is blank" do
    visit admin_business_path
    fill_in 'Name', :with => ''
    click_button 'Save'
    page.save_and_open_page
    page.text.must_include("can't be blank")
  end
end

businesss_controller.rb

class Admin::BusinessesController < Admin::AdminController

  def update
    @business = resource
    respond_to do |format|
      if @business.update_attributes(params[:business])
        flash[:notice] = "Your business was updated successfully."
      else
        flash[:notice] = "Your business failed to update."
      end
      format.js { render :template => "admin/businesses/edit" }
    end
  end

end

edit.js.erb

$("#page-businesses #main").html("<%= escape_javascript(render :partial => 'edit_information') %>");
4

0 に答える 0