Sha256: d72d6756049f144d0d5275fa5d23633352d71cf1603f5682ecdab2ecc9d172fe

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require 'test_helper'

class PunchforkTest < ActiveSupport::TestCase
    
  def setup
  end
  
  test "should use http by default" do
    Punchfork.setup { |config| config.protocol = 'http' }
    assert_equal 'http', URI.parse(Punchfork.search_url(:tomatoes).to_s).scheme
  end
  
  test "should use https" do
    Punchfork.setup { |config| config.protocol = 'http' }
    assert_equal 'https', URI.parse(Punchfork.search_url(:tomatoes, protocol: :https).to_s).scheme
  end
  
  test "should configure default to https" do
    Punchfork.setup { |config| config.protocol = 'https' }
    assert_equal 'https', URI.parse(Punchfork.search_url(:tomatoes).to_s).scheme
  end
  
  test "truth" do
    assert_kind_of Module, Punchfork
  end
  
  test "search should get 50 results" do
    response = Punchfork.search(:tomatoes, count:50)
    assert_equal 50, response['recipes'].length
  end
  
  test "should support method calls" do
    response = Punchfork.search(:tomatoes, count:50)
    assert_equal 50, response.recipes.length
  end
  
  test "search should support strings with spaces" do
    Punchfork.search('Heirloom Tomatoes')
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
punchfork-0.0.7 test/punchfork_test.rb
punchfork-0.0.6 test/punchfork_test.rb
punchfork-0.0.5 test/punchfork_test.rb
punchfork-0.0.4 test/punchfork_test.rb