Sha256: e356009d50d91f8eb48fe4f4b12deefe532f910b3a3583e32662a7501eed6ad8

Contents?: true

Size: 1.05 KB

Versions: 25

Compression:

Stored size: 1.05 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

class FileObjectTest < Test::Unit::TestCase
  include Octopi
  
  def setup
    fake_everything
    @user = User.find("fcoury")
    @repo = @user.repositories.find("octopi")
  end
  
  context "finding" do
    context "with strings" do
      should "work" do
        FileObject.find(:user => "fcoury", :repository => "octopi", :sha => "f6609209c3ac0badd004512d318bfaa508ea10ae")
      end
    end
    
    context "with objects" do
      should "work" do
        FileObject.find(:user => @user, :repository => @repo, :sha => "f6609209c3ac0badd004512d318bfaa508ea10ae")
      end
    end
    
    context "invalid sha" do
      should "not work" do
        # sha below is "ryan"
        exception = assert_raise NotFound do
          FileObject.find(:user => @user, :repository => @repo, :sha => "ea3cd978650417470535f3a4725b6b5042a6ab59")
        end
        
        assert_equal "The FileObject you were looking for could not be found, or is private.", exception.message
        
      end
    end
  end
  
end

Version data entries

25 entries across 25 versions & 4 rubygems

Version Path
octopi-0.4.5 test/file_object_test.rb
octopi-0.4.4 test/file_object_test.rb
octopi-0.4.2 test/file_object_test.rb
octopi-0.4.1 test/file_object_test.rb
octopi-0.4.0 test/file_object_test.rb
octopi-0.3.0 test/file_object_test.rb
dcuddeback-octopi-0.2.12 test/file_object_test.rb
dcuddeback-octopi-0.2.11 test/file_object_test.rb
dcuddeback-octopi-0.2.9 test/file_object_test.rb
dcuddeback-octopi-0.2.8 test/file_object_test.rb
devver-octopi-0.2.14 test/file_object_test.rb
tpitale-octopi-0.3.0 test/file_object_test.rb
devver-octopi-0.2.13 test/file_object_test.rb
devver-octopi-0.2.12 test/file_object_test.rb
octopi-0.2.8 test/file_object_test.rb
devver-octopi-0.2.11 test/file_object_test.rb
devver-octopi-0.2.10 test/file_object_test.rb
devver-octopi-0.2.9 test/file_object_test.rb
devver-octopi-0.2.8 test/file_object_test.rb
octopi-0.2.7 test/file_object_test.rb