Sha256: bf788379a5fcabdfca61d87069e0978f01dea2d410d0a448df38430bc0069fd3

Contents?: true

Size: 1.64 KB

Versions: 51

Compression:

Stored size: 1.64 KB

Contents

require 'spec_helper'

describe CoalescingPanda::LtiController, :type => :controller do
  routes { CoalescingPanda::Engine.routes }

  describe '#lti_config' do
    before :each do
      CoalescingPanda.class_variable_set(:@@lti_navigation, {})
      CoalescingPanda.lti_environments = { test_domain: 'test' }
    end

    it 'generates lti xml config'do
      get(:lti_config)
      xml = Nokogiri::XML(response.body)
      xml.at_xpath('//blti:title').text.should == 'LTI Tool'
      xml.at_xpath('//lticm:property[@name="domain"]').text.should_not == nil
      xml.at_xpath('//lticm:property[@name="privacy_level"]').text.should == 'public'
    end

    it 'generates lti nav config' do
      pending('cannot figure out why url: "test" is not working.')
      CoalescingPanda.stage_navigation(:account, {
        url: 'launch',
        text: 'My Title',
        enabled: false
      })
      CoalescingPanda.register_navigation(:account)
      CoalescingPanda.propagate_lti_navigation
      get(:lti_config)
      xml = Nokogiri::XML(response.body)
      account_nav = xml.at_xpath('//lticm:options[@name="account_navigation"]')
      account_nav.at_xpath('lticm:property[@name="enabled"]').text.should == 'false'
      account_nav.at_xpath('lticm:property[@name="text"]').text.should == 'My Title'
      account_nav.at_xpath('lticm:property[@name="url"]').text.should == 'foo'
    end

    it 'includes environment information' do
      get(:lti_config)
      xml = Nokogiri::XML(response.body)
      environments = xml.at_xpath('//lticm:options[@name="environments"]')
      environments.at_xpath('lticm:property[@name="test_domain"]').text.should == 'test'
    end

  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
coalescing_panda-5.3.0 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.2.2 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.2.2.beta1 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.2.1 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.2.0 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.2.0.beta2 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.2.0.beta1 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.13 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.12 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.11 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.10 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.9 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.8 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.7 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.6 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.5 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.4 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.3.beta.2 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.3.beta.1 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-5.1.3 spec/controllers/coalescing_panda/lti_controller_spec.rb