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

Fix type validator message #501

Merged
merged 2 commits into from
Dec 16, 2016
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
3 changes: 1 addition & 2 deletions lib/apipie/validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def self.build(param_description, argument, options, block)
end

def description
"Must be #{@type}"
"Must be a #{@type}"
end

def expected_type
Expand Down Expand Up @@ -464,4 +464,3 @@ def params_ordered

end
end

8 changes: 4 additions & 4 deletions spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def reload_controllers
params = Apipie[UsersController, :create].to_json[:params]
expect(params).to include(:name => "facts",
:full_name => "facts",
:validator => "Must be Hash",
:validator => "Must be a Hash",
:description => "\n<p>Additional optional facts about the user</p>\n",
:required => false,
:allow_nil => true,
Expand Down Expand Up @@ -525,7 +525,7 @@ def reload_controllers
:params => [{:full_name=>"oauth",
:required=>false,
:allow_nil => false,
:validator=>"Must be String",
:validator=>"Must be a String",
:description=>"\n<p>Authorization</p>\n",
:name=>"oauth",
:show=>true,
Expand All @@ -550,14 +550,14 @@ def reload_controllers
:params=>
[{:required=>true,
:allow_nil => false,
:validator=>"Must be String",
:validator=>"Must be a String",
:description=>"\n<p>Username for login</p>\n",
:name=>"ausername", :full_name=>"resource_param[ausername]",
:show=>true,
:expected_type=>"string"},
{:required=>true,
:allow_nil => false,
:validator=>"Must be String",
:validator=>"Must be a String",
:description=>"\n<p>Password for login</p>\n",
:name=>"apassword", :full_name=>"resource_param[apassword]",
:show=>true,
Expand Down