Sha256: 225406af2f14b7eb792f5249b7e0e1ebcc639d30ec77d502ef83513e9aeb5740

Contents?: true

Size: 1.45 KB

Versions: 30

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe CoalescingPanda::LtiController do
  routes { CoalescingPanda::Engine.routes }

  describe '#lti_config' do

    it 'generates lti xml config'do
      controller.main_app.stub(:test_action_url) {'foo'}
      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
      controller.main_app.stub(:test_action_url) {'foo'}
      CoalescingPanda.stage_navigation(:account, {
        url: 'test_action',
        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

  end


  it 'get the url, from the action string' do
    controller.main_app.stub(:test_action_url) {'foo'}
    options = controller.send(:ext_params, {url:'test_action'})
    options[:url].should == 'foo'
  end


end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
coalescing_panda-1.1.21.1 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.21 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.20 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.19 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-2.0.0 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.18 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.17 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.16 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.15 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.14 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.13 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.12 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.11 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.10 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.8 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.7 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.6 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.5 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.3 spec/controllers/coalescing_panda/lti_controller_spec.rb
coalescing_panda-1.1.0 spec/controllers/coalescing_panda/lti_controller_spec.rb