Sha256: 5c0a00178aab333919ccb0641f795c0dc1a71dd7ef06060dcd785879a9f80180

Contents?: true

Size: 866 Bytes

Versions: 4

Compression:

Stored size: 866 Bytes

Contents

shared_context :webapp_fixture do
  require 'sinatra/base'

  let(:rack_app) do
    Class.new(Sinatra::Base) do
      get '/page1' do
        "<html><head><title>page1</title></head><body><a href='/page2'>next page</a></body></html>"
      end

      get '/page2' do
        'page 2 content'
      end

      get '/elements' do
        <<-ELEMENTS
          <a href='#'>a link</a>


          <div id='form' class="form">
            <a id='form_link' href='/page2'>link in a form</a>
            <label>enter text
              <input id='field_id' name='field_name' class='input_class' type='text' value='filled in'/>
            </label>
            <button id='form_button' type='submit' value='a button'/>
          </form>

        ELEMENTS
      end
    end
  end

  before :each do
    Capybara.app = rack_app
  end

  after do
    Capybara.reset!
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
page_magic-1.2.9 spec/support/shared_contexts/webapp_fixture_context.rb
page_magic-1.2.8 spec/support/shared_contexts/webapp_fixture_context.rb
page_magic-1.2.8.alpha spec/support/shared_contexts/webapp_fixture_context.rb
page_magic-1.2.7 spec/support/shared_contexts/webapp_fixture_context.rb