Sha256: a76db48569752f28c12806c6ae6cb2735c515102ab90dc6eeee48992c6e4eca3

Contents?: true

Size: 819 Bytes

Versions: 1

Compression:

Stored size: 819 Bytes

Contents

require 'spec_helper'

describe LocaleApp::KeyChecker, "#check(key)" do
  it "returns false and an empty hash if the response from locale app is a 404" do
    FakeWeb.register_uri(:get, 'http://api.localeapp.com/v1/projects/TEST_KEY.json', :body => "", :status => ['404', 'Not Found'])
    with_configuration do
      @checker = LocaleApp::KeyChecker.new
    end
    @checker.check('TEST_KEY').should == [false, {}]
  end

  it "returns true and and the parsed json hash if the response from locale app is a 200" do
    FakeWeb.register_uri(:get, 'http://api.localeapp.com/v1/projects/TEST_KEY.json', :body => valid_project_data.to_json, :status => ['200', 'OK'])
    with_configuration do
      @checker = LocaleApp::KeyChecker.new
    end
    @checker.check('TEST_KEY').should == [true, valid_project_data]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
localeapp-0.0.7 spec/locale_app/key_checker_spec.rb