Sha256: 60abb7ddb79ff67b04372a9dcc98251fa8372a78f09da7592fe3a9640eeff2e4

Contents?: true

Size: 854 Bytes

Versions: 7

Compression:

Stored size: 854 Bytes

Contents

require File.expand_path('../../../test_helper', __FILE__)
require File.expand_path('../../../resource_test', __FILE__)

module MeducationSDK
  class Badges::BadgeTest < ResourceTest

    def self.test_badge(klass)
      define_method :klass do klass end

      class_eval do
        def test_issue_or_update_progress_calls_loquor
          user_id = 12
          url = "#{klass.path}/issue_or_update_progress"
          Loquor.expects(:put).with(url, user_id: user_id)
          klass.issue_or_update_progress(user_id)
        end

        def test_user_calls_sdk
          badge = klass.new(user_id: 3)
          MeducationSDK::User.expects(:find).with(3)
          badge.user
        end

        def test_ruby_gets_called
          return unless ENV["INTEGRATION"]
          klass.issue_or_update_progress(2)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
meducation_sdk-1.5.1 test/resources/badges/badge_test.rb
meducation_sdk-1.5.0 test/resources/badges/badge_test.rb
meducation_sdk-1.4.4 test/resources/badges/badge_test.rb
meducation_sdk-1.4.3 test/resources/badges/badge_test.rb
meducation_sdk-1.4.2 test/resources/badges/badge_test.rb
meducation_sdk-1.4.1 test/resources/badges/badge_test.rb
meducation_sdk-1.4.0 test/resources/badges/badge_test.rb