Sha256: 5db25e338842846fcb276e04f9aa05a45eb7d4a6cbd69b249df98be7f7df5412

Contents?: true

Size: 1.53 KB

Versions: 3

Compression:

Stored size: 1.53 KB

Contents

# -*- coding: utf-8 -*-
require 'test_helper'

class OembedProviderControllerTest < ActionController::TestCase

  tests OembedProviderEngine::OembedProviderController

  context "The oembed provider controller" do
    setup do
      @photo = FactoryGirl.create(:photo)
    end

    should "endpoint" do
      get :endpoint, :url => "http://example.com/photos/#{@photo.id}", use_route: "root"
      assert_response :success
    end

    should "endpoint with format json" do
      @request.accept = "text/javascript"
      get :endpoint, :url => "http://example.com/photos/#{@photo.id}", :format => 'json', use_route: "root"
      assert_response :success
    end

    should "endpoint with format json and callback, return json-p" do
      @request.accept = "text/javascript"
      get :endpoint, :url => "http://example.com/photos/#{@photo.id}", :format => 'json', :callback => 'myCallback', use_route: "root"
      assert_response :success
    end

    should "endpoint with format xml" do
      @request.accept = "text/xml"
      get :endpoint, :url => "http://example.com/photos/#{@photo.id}", :format => 'xml', use_route: "root"
      assert_response :success
    end

    context "base attributes" do
      setup do
        get :endpoint, :url => "http://example.com/photos/#{@photo.id}", :format => 'json', use_route: "root"
        @json = JSON.parse(response.body)
      end

      should "have version" do
        assert @json["version"].present?
      end

      should "have type" do
        assert_equal @json["type"], "photo"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oembed_provider_engine-0.2.0 test/functional/oembed_provider_controller_test.rb
oembed_provider_engine-0.1.0 test/functional/oembed_provider_controller_test.rb
oembed_provider_engine-0.0.1 test/functional/oembed_provider_controller_test.rb