Sha256: 49dded58c95b8af90360e259dd95342215421792cdbabd8e7af12664a1371b25

Contents?: true

Size: 1.39 KB

Versions: 9

Compression:

Stored size: 1.39 KB

Contents

describe "AFMotion" do

  modules = [AFMotion::HTTP, AFMotion::JSON, AFMotion::XML, AFMotion::PLIST]

  modules.each do |_module|
    describe _module.to_s do
      it "should have all the HTTP methods" do
        AFMotion::HTTP_METHODS.each do |method|
          _module.respond_to?(method).should == true
        end
      end

      describe ".get" do
        before do
          @result = nil
        end

        it "should work with string" do
          _module.get("http://google.com") do |result|
            @result = result
            resume
          end
          wait_max(10) do
            @result.nil?.should == false
          end
        end

        it "should work with request" do
          request = NSURLRequest.requestWithURL(NSURL.URLWithString("http://google.com"))
          _module.get(request) do |result|
            @result = result
            resume
          end
          wait_max(10) do
            @result.nil?.should == false
          end
        end
      end
    end
  end

  describe "AFMotion::Image" do
    before do
      @result = nil
    end

    it "should work with an image" do
      url = "https://www.google.com/images/srpr/logo3w.png"
      AFMotion::Image.get(url) do |result|
        @result = result
        resume
      end
      wait_max(10) do
        @result.nil?.should == false
        @result.object.is_a?(UIImage).should == true
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
afmotion-0.9.0 spec/http_spec.rb
afmotion-0.8.1 spec/http_spec.rb
afmotion-0.8 spec/http_spec.rb
afmotion-0.7 spec/http_spec.rb
afmotion-0.6 spec/http_spec.rb
afmotion-0.5 spec/http_spec.rb
afmotion-0.4 spec/http_spec.rb
afmotion-0.3 spec/http_spec.rb
afmotion-0.2 spec/http_spec.rb