Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

Commit

Permalink
Update gems and clean up test format
Browse files Browse the repository at this point in the history
--need to fix file.rb so that initialization arguments are not ambiguous
  • Loading branch information
sax committed Mar 10, 2012
1 parent 87fff28 commit 0cb707b
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 164 deletions.
4 changes: 4 additions & 0 deletions Gemfile
Expand Up @@ -2,3 +2,7 @@ source "http://rubygems.org"

# Specify your gem's dependencies in fake_ftp.gemspec
gemspec

group :test do
gem "guard-rspec"
end
25 changes: 16 additions & 9 deletions Gemfile.lock
@@ -1,27 +1,34 @@
PATH
remote: .
specs:
fake_ftp (0.0.8)
fake_ftp (0.0.9)

GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.3)
ffi (1.0.11)
guard (1.0.1)
ffi (>= 0.5.0)
thor (~> 0.14.6)
guard-rspec (0.6.0)
guard (>= 0.10.0)
rake (0.9.2.2)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
rspec-mocks (~> 2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
rspec-mocks (~> 2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.7.0)
rspec-mocks (2.8.0)
thor (0.14.6)

PLATFORMS
ruby

DEPENDENCIES
bundler (>= 1.0.10)
fake_ftp!
guard-rspec
rake (>= 0.8.7)
rspec (> 2)
10 changes: 10 additions & 0 deletions Guardfile
@@ -0,0 +1,10 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard 'rspec', :version => 2 do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
end

1 change: 0 additions & 1 deletion fake_ftp.gemspec
Expand Up @@ -15,7 +15,6 @@ Gem::Specification.new do |s|
s.required_rubygems_version = ">= 1.3.6"
s.rubyforge_project = "fake_ftp"

s.add_development_dependency "bundler", '>=1.0.10'
s.add_development_dependency "rspec", '>2'
s.add_development_dependency "rake", '>=0.8.7'

Expand Down
4 changes: 3 additions & 1 deletion lib/fake_ftp/file.rb
Expand Up @@ -9,8 +9,10 @@ def initialize(name = nil, data = nil, type = nil)
@created = Time.now
@name = name
@data = data
# FIXME this is far too ambiguous. args should not mean different
# things in different contexts.
data_is_bytes = (data.nil? || Integer === data)
@bytes = data_is_bytes ? data : data.length
@bytes = data_is_bytes ? data : data.to_s.length
@data = data_is_bytes ? nil : data
@type = type
end
Expand Down
20 changes: 10 additions & 10 deletions lib/fake_ftp/server.rb
Expand Up @@ -88,10 +88,10 @@ def parse(request)
contents = request.split
message = contents[1..contents.length]
case command
when *CMDS
__send__ "_#{command}", *message
else
'500 Unknown command'
when *CMDS
__send__ "_#{command}", *message
else
'500 Unknown command'
end
end

Expand Down Expand Up @@ -209,12 +209,12 @@ def _stor(filename = '')

def _type(type = 'A')
case type.to_s
when 'A'
'200 Type set to A.'
when 'I'
'200 Type set to I.'
else
'504 We don\'t allow those'
when 'A'
'200 Type set to A.'
when 'I'
'200 Type set to I.'
else
'504 We don\'t allow those'
end
end

Expand Down

0 comments on commit 0cb707b

Please sign in to comment.