suhyo 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -83,11 +83,15 @@ module Suhyo
83
83
 
84
84
  class HaveRestfulForm < ::Webrat::Matchers::HaveSelector
85
85
  def initialize(method, options = {}, &block)
86
+ raise(ArgumentError, "Expected options to be a Hash, but got #{options.inspect}") unless options.is_a?(Hash)
86
87
  @options = options
87
88
  @method = method.to_s.downcase
89
+ unless @method == 'get' or @method == 'post' or @method == 'put' or @method == 'delete'
90
+ raise(ArgumentError, "Expected method to be 'get', 'post', 'put', or 'delete', but got #{method.inspect}")
91
+ end
88
92
  # browser_method is the method the browser actually uses, either GET or POST
89
93
  @browser_method = (method == 'get') ? 'get' : 'post'
90
- if ancestors = options.delete(:ancestors)
94
+ if ancestors = @options.delete(:ancestors)
91
95
  @expected = ancestors + ' form'
92
96
  else
93
97
  @expected = 'form'
@@ -80,5 +80,15 @@ describe Suhyo::ViewMatchers do
80
80
  '<form action="http://example.com" method="get"></form>'.should have_restful_form('get', :action => 'http://example.com')
81
81
  '<form action="http://example.com" method="get"></form>'.should_not have_restful_form('get', :action => 'http://google.com')
82
82
  end
83
+
84
+ it 'raises ArgumentError if method is not get, post, put, or delete' do
85
+ lambda { restful_form('get').should have_restful_form('foo') }.should raise_error(ArgumentError)
86
+ lambda { restful_form('get').should have_restful_form(42) }.should raise_error(ArgumentError)
87
+ end
88
+
89
+ it 'raises ArgumentError if options is not a hash' do
90
+ lambda { restful_form('get').should have_restful_form('get', 42) }.should raise_error(ArgumentError)
91
+ lambda { restful_form('get').should have_restful_form('get', 'foo') }.should raise_error(ArgumentError)
92
+ end
83
93
  end
84
94
  end
data/suhyo.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{suhyo}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jarrett"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suhyo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jarrett