Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issues preventing use with Ruby 1.8 #218

Merged
merged 1 commit into from
Mar 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apipie-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]

s.add_dependency "rails", ">= 3.0.10"
s.add_dependency 'json'
s.add_development_dependency "rspec-rails"
s.add_development_dependency "sqlite3"
s.add_development_dependency "minitest"
s.add_development_dependency "maruku"
s.add_development_dependency "RedCloth"
s.add_development_dependency "rake"
s.add_development_dependency "rdoc"
end
2 changes: 1 addition & 1 deletion lib/apipie/routing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Routing
module MapperExtensions
def apipie
namespace "apipie", :path => Apipie.configuration.doc_base_url do
get 'apipie_checksum', to: "apipies#apipie_checksum", :format => "json"
get 'apipie_checksum', :to => "apipies#apipie_checksum", :format => "json"
constraints(:version => /[^\/]+/) do
get("(:version)/(:resource)/(:method)" => "apipies#index", :as => :apipie)
end
Expand Down
4 changes: 3 additions & 1 deletion lib/apipie/validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ def process_value(value)
end

def self.build(param_description, argument, options, block)
self.new(param_description, block, options[:param_group]) if block.is_a?(Proc) && block.arity == 0 && argument == Array
# in Ruby 1.8.x the arity on block without args is -1
# while in Ruby 1.9+ it is 0
self.new(param_description, block, options[:param_group]) if block.is_a?(Proc) && block.arity <= 0 && argument == Array
end

def description
Expand Down
5 changes: 3 additions & 2 deletions spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ def compare_hashes(h1, h2)
end
context "with bad input" do
it "should raise an error" do
expect{ put :update,
expect{
put :update,
{
:id => 5,
:user => {
Expand All @@ -276,7 +277,7 @@ def compare_hashes(h1, h2)
:comment => 'comment1'
},
{
:comment => {bad_input: 5}
:comment => {:bad_input => 5}
}
]
}
Expand Down