Sha256: 8e628d52d20aceec76f208bc8278d54bb4e73c3206d0f9df712ce2202eae7bc8

Contents?: true

Size: 1.74 KB

Versions: 12

Compression:

Stored size: 1.74 KB

Contents

require 'spec_helper'

RSpec.shared_examples 'tumblr/expectations' do
  it 'should show news stories' do
    visit '/tumblr_api.html'
    expect(page).to have_link('News Item 1', href: 'http://example.com/news/1')
    expect(page).to have_content('News item 1 content here')
    expect(page).to have_link('News Item 2', href: 'http://example.com/news/2')
    expect(page).to have_content('News item 2 content here')
  end
end

describe 'Tumblr API example', type: :feature, js: true do
  context 'without scope external references' do
    before do
      proxy.stub('http://blog.howmanyleft.co.uk/api/read/json').and_return(
        jsonp: {
          posts: [
            {
              'regular-title' => 'News Item 1',
              'url-with-slug' => 'http://example.com/news/1',
              'regular-body' => 'News item 1 content here'
            },
            {
              'regular-title' => 'News Item 2',
              'url-with-slug' => 'http://example.com/news/2',
              'regular-body' => 'News item 2 content here'
            }
          ]
        })
    end

    include_examples 'tumblr/expectations'
  end

  context 'with scope external references' do
    let(:posts) do
      [
        {
          'regular-title' => 'News Item 1',
          'url-with-slug' => 'http://example.com/news/1',
          'regular-body' => 'News item 1 content here'
        },
        {
          'regular-title' => 'News Item 2',
          'url-with-slug' => 'http://example.com/news/2',
          'regular-body' => 'News item 2 content here'
        }
      ]
    end

    before do
      proxy.stub('http://blog.howmanyleft.co.uk/api/read/json')
           .and_return(proc { { jsonp: { posts: posts } } })
    end

    include_examples 'tumblr/expectations'
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
puffing-billy-3.0.0 spec/features/examples/tumblr_api_spec.rb
puffing-billy-2.4.1 spec/features/examples/tumblr_api_spec.rb
puffing-billy-2.4.0 spec/features/examples/tumblr_api_spec.rb
puffing-billy-2.3.1 spec/features/examples/tumblr_api_spec.rb
puffing-billy-2.3.0 spec/features/examples/tumblr_api_spec.rb
puffing-billy-2.2.0 spec/features/examples/tumblr_api_spec.rb
puffing-billy-2.1.1 spec/features/examples/tumblr_api_spec.rb
puffing-billy-2.1.0 spec/features/examples/tumblr_api_spec.rb
puffing-billy-2.0.0 spec/features/examples/tumblr_api_spec.rb
puffing-billy-1.1.3 spec/features/examples/tumblr_api_spec.rb
puffing-billy-1.1.2 spec/features/examples/tumblr_api_spec.rb
puffing-billy-1.1.1 spec/features/examples/tumblr_api_spec.rb