Sha256: b11655d208d0d028ebfcbef9917d84a96bb3a857ae34e71049e68256b1d16a88

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe 'Fetch data via javascript', :js do
  before :each do
    config = Class.new do
      include FeduxOrg::Stdlib::Filesystem

      def root_directory
        ::File.expand_path('../../../', __FILE__)
      end

      def log_level
       :unknown
      end

      def access_log 
        File.join(working_directory, 'access.log')
      end

      def reload_config_signal
        'USR1'
      end
    end.new

    TestServer.config = config

    #Capybara.app = Rack::Builder.new do
    #  map '/' do
    #    run TestServer::App::JavascriptController
    #  end

    #  map '/assets' do
    #    run TestServer::App::AssetsController.assets
    #  end
    #end
  end

  context '/generator/xhr' do
    it 'submits requests to url' do
      url = '/generator/xhr'
      visit url

      within '#form' do
        fill_in 'url', :with => url
        fill_in 'count', :with => 1
      end


      click_button('start')

      first '.ts-result-row'

      expect(page).to have_content(url)
    end

    #it 'supports opening a new page based on given values' do
    #  url = '/generator/xhr'
    #  visit '/generator/xhr'

    #  within '#form' do
    #    fill_in 'url', :with => url
    #    fill_in 'count', :with => 1
    #    fill_in 'timeout', :with => 100
    #    find('#repeat').trigger('click')
    #  end

    #  click_link('clone')

    #  within_window '' do
    #    expect(find('#url').value).to eq url
    #    expect(find('#count').value).to eq '1'
    #    expect(find('#timeout').value).to eq '100'
    #    expect(find('#repeat').checked?).to be true
    #  end
    #end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
test_server-0.5.2 spec/features/fetch_data_via_javascript_spec.rb
test_server-0.5.1 spec/features/fetch_data_via_javascript_spec.rb
test_server-0.5.0 spec/features/fetch_data_via_javascript_spec.rb