0
0
Commit Graph

109 Commits

Author SHA1 Message Date
Gibheer
a6fa1475a2 cleanup old specs 2013-02-12 08:39:45 +01:00
Gibheer
f18ab69a91 extracted the building of template tree
This step is a preparation to extend the functionality of the renderer.
To make the main class easier, the search for templates and building of
the tree is extracted into its own class.
2013-02-12 08:29:33 +01:00
Gibheer
1133c4106f rename spec for mutant
That kills 52 mutations!
2013-02-04 18:03:43 +01:00
Gibheer
335dbdd487 catch empty routes
This fixes a bug where an empty route would catch all requests resulting
in all routes found with the empty route.
2013-01-29 15:28:59 +01:00
Gibheer
a2aed1fa20 make request and response static
This is a step back but makes the controller work for the moment. It
should be reimplemented in a better way in the future.
2013-01-29 10:34:48 +01:00
Gibheer
b317b05f90 use new api of class_options 2013-01-28 15:49:53 +01:00
Gibheer
399e0ea338 use class_options for the controller 2013-01-11 16:02:26 +01:00
Gibheer
c75f61de6e added a spec for custom parameters 2013-01-11 08:06:35 +01:00
Gibheer
6fd096d4ab split of specs for [] and []=
As mutant can't use one spec file for both methods it got split up into
two. I also cleaned up the tests and made them (hopefully) better
readable.
2013-01-11 08:05:43 +01:00
Gibheer
9e83d9d8b5 easier environment generation
This still needs some work, but it should definitly be easier to
generate new environments now. Why is that even so much work?
2013-01-11 08:02:46 +01:00
Gibheer
d645a2eb49 reworked the tests to make them cleaner
The tests now use simple lists for the types to make it easier to
distinguish between all elements.
The tests themselves are also shared now.
2013-01-10 21:43:12 +01:00
0ef61c062f Rename Zero::Request::AcceptType spec folder 2013-01-10 20:18:03 +01:00
158dc45ba6 Kill the last mutant in Zero::Request:AcceptType 2013-01-10 19:37:03 +01:00
Gibheer
ae0b32a58f take strings for body
This makes the assignment for bodies easier when using plain Strings.
They get wrapped in an array as per rack definition.
For every other type, they have to implement each and get directly set
as body or have to be rendered to Strings first.
2013-01-09 20:08:26 +01:00
69aa01cabc Split response_spec.rb into single test files 2013-01-06 20:46:29 +01:00
3a82183563 Improve test structure
Created folder spec/unit/zero and moved all unittest into this folder.
2013-01-06 20:24:39 +01:00
b54c2569a4 Kill all mutants in Zero::Router 2013-01-06 19:09:44 +01:00
2c558846ec Kill all mutants in Zero::Renderer 2013-01-06 17:39:57 +01:00
e81dff9c07 Kill all mutants i Zero::Request
Fix tests for PATCH, because spec_helper didn't support it and the tests where
wrong.
Remove if statement from "conent_type", because ruby already returns nil, if the
requested key in a hash is not found. (Sounds a bit ugly, but it's true.)
2013-01-06 12:37:07 +01:00
cd97198e22 Kill all mutants in Zero::Request::Parameter
I've also changed "extract_query_params" because it does not matter, if the
query string it empty or not for the "parse_string" method.
2013-01-06 10:28:13 +01:00
3bb53d7343 Kill almost all mutants in Zero::Request:AcceptType
Killed 13 of 14 mutants. I will see later, how it's possible to kill the last
one.
I also fixed the return value of "preferred", if the in initialize given string
is empty. Fixed the default value here.
2013-01-05 18:30:36 +01:00
5ca122b84c Kill all mutants in Zero::Request::Accept 2013-01-04 20:25:48 +01:00
7870c5c51f Kill mutant in Zero::Request::Server 2013-01-04 19:42:25 +01:00
f4fa025b4d Add check if body is empty on 204 and 304 in specs 2013-01-04 16:46:21 +01:00
65b1d3a1da Remove 1.8 fixes
The fixes for Ruby 1.8 will take place in a seperate gem. So I remove
all the changes here.
2012-12-23 12:23:14 +01:00
96f2b7a6c4 Replace 'parse_query_string' with 'decode_www_form_18' in test 2012-12-22 19:58:59 +01:00
fac934af6d Renamed specfile. Will test other method here. 2012-12-22 19:19:02 +01:00
835234a52c Improve query valid regex
Now a query string cannot look like 'foo=bar=foo' anymore.
2012-12-22 19:08:02 +01:00
bfca378f8f Add first implementation of decode_www_form_18
Seperates now foo=bar&bar=foo;baz=foo queries. But does not fix url
encoded strings and such things.
Also added testcase for an empty query string.
2012-12-22 13:09:15 +01:00
443958f885 Add patch for URI decode_www_form
Plus some specs.
This should it make later possible to make Zero work with Ruby 1.8. But
at the moment it only routes to the original decode_www_form method, if
it exists. Otherwise it returns an empty Array. So this will still fail
on the 1.8 versions at the moment.
2012-12-22 11:44:26 +01:00
Gibheer
b20c0c527c reuse render for actual rendering
The splitting of rendering and processing is good, but on the other side
it makes some double steps or even introduce workarounds.
That is why I made the method #render just a call to the renderer. This
should help much more than the strict seperation.

The method will only return the resulting string and not add it to the
body of the response. That still has to be taken care of by the user.
2012-12-18 04:24:24 +01:00
Gibheer
6fbb12c0fd cleanup gemfile for jruby on travis 2012-12-17 19:22:20 +01:00
Gibheer
daee3c5975 run simplecov only when needed 2012-12-17 18:18:20 +01:00
Gibheer
2353a579ca initialize the response 2012-12-17 16:29:29 +01:00
Gibheer
7bda0ec7e5 added options to controller
This avoids hardcoding the options into the controller and therefore
should it make possible to use Rack::Request or Sinatra apps as
requests. (That sounds so weird.)
2012-12-13 08:45:03 +01:00
Gibheer
a95f1436c4 replaced .create with .new on Zero::Request 2012-12-12 18:38:46 +01:00
Gibheer
e0919c87e5 define the renderer at initialization 2012-12-10 21:12:45 +01:00
Gibheer
55052f83ef avoid changing existing environment keys 2012-12-01 07:23:37 +01:00
Gibheer
5c07e72076 delete all.rb in favorite of zero.rb 2012-11-30 19:57:30 +01:00
6b9f34cb61 Optional setting of status code on redirect 2012-11-30 19:13:41 +01:00
facd4f143b Add redirect to response
Now a relocation can be done, by calling redirect with the URL you want
relocate to.
This will set the Location header and set the status code to 302.
2012-11-30 18:58:32 +01:00
Gibheer
f89ef14687 specs for the renderer access 2012-11-30 16:22:49 +01:00
Gibheer
ec446a53b1 use URI to get parameters 2012-11-30 14:46:52 +01:00
Gibheer
9cea623595 don't overwrite the request 2012-11-29 22:22:50 +01:00
74bbc7f186 Throws an ArgumentError, if no template fits given types 2012-11-29 21:41:13 +01:00
67dd2aa4d5 Throws ArgumentError, if given template does not exist 2012-11-29 21:25:50 +01:00
eccd314e23 Add default value for default templates
If a template has no type specifcation in it's name, then we use
'default' as map name now.
2012-11-29 21:11:31 +01:00
Gibheer
c6623d47df added custom parameters in the router 2012-11-29 20:02:28 +01:00
Gibheer
8c7eed073c added custom parameter 2012-11-29 19:44:12 +01:00
Gibheer
2762f68363 better specs for render 2012-11-27 21:02:07 +01:00