Sha256: f7c7e953a4ed435b4e1c1c2149db904881710ae72bb7c5eb493f9a11b4fb6afc

Contents?: true

Size: 1.59 KB

Versions: 8

Compression:

Stored size: 1.59 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

8 entries across 8 versions & 1 rubygems

Version Path
test_server-0.4.1 spec/features/fetch_data_via_javascript_spec.rb
test_server-0.4.0 spec/features/fetch_data_via_javascript_spec.rb
test_server-0.3.7 spec/features/fetch_data_via_javascript_spec.rb
test_server-0.3.6 spec/features/fetch_data_via_javascript_spec.rb
test_server-0.3.5 spec/features/fetch_data_via_javascript_spec.rb
test_server-0.3.4 spec/features/fetch_data_via_javascript_spec.rb
test_server-0.3.2 spec/features/fetch_data_via_javascript_spec.rb
test_server-0.3.1 spec/features/fetch_data_via_javascript_spec.rb