spec/dslable_args_spec.rb in dslable-0.0.2 vs spec/dslable_args_spec.rb in dslable-0.0.3

- old
+ new

@@ -1,29 +1,29 @@ # encoding: utf-8 -require "spec_helper" -require "dslable_args" +require 'spec_helper' +require 'dslable_args' describe Dslable::Args do context :desc do cases = [ { case_no: 1, - case_title: "valid description", - input: "this is descripotion", - expected: "this is descripotion" + case_title: 'valid description', + input: 'this is descripotion', + expected: 'this is descripotion' }, { case_no: 2, - case_title: "empty description", - input: "", - expected: "" + case_title: 'empty description', + input: '', + expected: '' }, { case_no: 3, - case_title: "nil description", + case_title: 'nil description', input: nil, - expected: "" + expected: '' }, ] cases.each do |c| it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do @@ -56,30 +56,30 @@ context :args_name do cases = [ { case_no: 1, - case_title: "valid dsl_args name", - input: "abcdefghijklmnopqrstuvwxyz01234567891_", - expected: "abcdefghijklmnopqrstuvwxyz01234567891_" + case_title: 'valid dsl_args name', + input: 'abcdefghijklmnopqrstuvwxyz01234567891_', + expected: 'abcdefghijklmnopqrstuvwxyz01234567891_' }, { case_no: 2, - case_title: "empty dsl_args name", - input: "", + case_title: 'empty dsl_args name', + input: '', expect_error: true }, { case_no: 3, - case_title: "nil dsl_args name", + case_title: 'nil dsl_args name', input: nil, expect_error: true }, { case_no: 4, - case_title: "invalid dsl_args name contain space", - input: "method name", + case_title: 'invalid dsl_args name contain space', + input: 'method name', expect_error: true }, ] cases.each do |c| @@ -90,11 +90,11 @@ # -- given -- dslable_args = Dslable::Args.new # -- when -- if c[:expect_error] - lambda {dslable_args.args_name c[:input]}.should raise_error(Dslable::InvalidArgsError) + lambda { dslable_args.args_name c[:input] }.should raise_error(Dslable::InvalidArgsError) next end dslable_args.args_name c[:input] actual = dslable_args._args_name @@ -117,38 +117,44 @@ context :klass do cases = [ { case_no: 1, - case_title: "valid klass String", + case_title: 'valid klass String', input: String, expected: String }, { case_no: 2, - case_title: "valid klass Array", + case_title: 'valid klass Array', input: Array, expected: Array }, { case_no: 3, - case_title: "valid klass Hash", + case_title: 'valid klass Hash', input: Hash, expected: Hash }, { case_no: 4, - case_title: "invalid klass Hash", + case_title: 'invalid klass Hash', input: Fixnum, expect_error: true }, { case_no: 5, - case_title: "nil klass", + case_title: 'nil klass', input: nil, expect_error: true }, + { + case_no: 6, + case_title: 'valid klass Boolean', + input: :Boolean, + expected: :Boolean + }, ] cases.each do |c| it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do begin @@ -157,11 +163,11 @@ # -- given -- dslable_args = Dslable::Args.new # -- when -- if c[:expect_error] - lambda {dslable_args.klass c[:input]}.should raise_error(Dslable::InvalidArgsError) + lambda { dslable_args.klass c[:input] }.should raise_error(Dslable::InvalidArgsError) next end dslable_args.klass c[:input] actual = dslable_args._klass @@ -184,11 +190,11 @@ context :required do cases = [ { case_no: 1, - case_title: "valid required", + case_title: 'valid required', expected: true }, ] cases.each do |c| @@ -222,12 +228,12 @@ context :default_value do cases = [ { case_no: 1, - case_title: "valid default", - input: "valid default", - expected: "valid default" + case_title: 'valid default', + input: 'valid default', + expected: 'valid default' }, ] cases.each do |c| it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do