Sha256: 64fac668c5556e02438778ca072c39fe57a665b58ba9aab08167e92b46c5b8c5

Contents?: true

Size: 1.55 KB

Versions: 7

Compression:

Stored size: 1.55 KB

Contents

require 'test_helper'

class ChoicesTest < Totter::TestCase
  def test_decision
    VCR.use_cassette 'choices/show' do
      client = local_client
      choice = client.choice(3, 12, 1)
      assert_equal 'ImageChoice', choice.type
    end
  end

  def test_create_choice_for_image
    VCR.use_cassette 'choices/create_for_image' do
      client = local_client
      data = {
        :image_url => 'http://recess.s3.amazonaws.com/default_avatars/v1/photo_1.png',
        :subject => 'Test Image',
        :link_url => 'http://seesaw.co',
        :link_title => 'Seesaw'
      }
      decision = client.create_decision(1)
      choice = client.create_choice_for_image(decision.user_id, decision.id, data)
      assert_equal data[:subject], choice.subject
      assert_equal data[:link_url], choice.meta.link_url
      assert_equal data[:link_title], choice.meta.link_title
      refute choice.respond_to?(:upload), 'should not have an upload form'
    end
  end

  def test_create_choice_upload
    VCR.use_cassette 'choices/create_choice_upload' do
      client = local_client
      decision = client.create_decision(1)
      choice = client.create_choice_upload(decision.user_id, decision.id)

      assert choice.respond_to?(:upload), 'should have an upload form'
    end
  end

  def test_destroy_choice
    VCR.use_cassette 'choices/destroy' do
      client = local_client
      decision = client.create_decision(1)
      choice = client.create_choice_upload(decision.user_id, decision.id)
      assert client.destroy_choice(decision.user_id, decision.id, choice.id)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
totter-0.3.8 test/totter/client/choices_test.rb
totter-0.3.7 test/totter/client/choices_test.rb
totter-0.3.6 test/totter/client/choices_test.rb
totter-0.3.5 test/totter/client/choices_test.rb
totter-0.3.4 test/totter/client/choices_test.rb
totter-0.3.3 test/totter/client/choices_test.rb
totter-0.3.2 test/totter/client/choices_test.rb