cogy 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,17 +7,17 @@ module Cogy
7
7
  setup { @routes = Engine.routes }
8
8
 
9
9
  def test_args_helper_overrides_predefined_helpers
10
- get "/cogy/cmd/args_overrides/george", cog_argv_1: "hu", cog_argv_0: "haha"
10
+ post "/cogy/cmd/args_overrides/george", COG_ARGV_1: "hu", COG_ARGV_0: "haha"
11
11
  assert_equal "hahahu", response.body
12
12
  end
13
13
 
14
14
  def test_args_with_empty_arguments
15
- get "/cogy/cmd/empty_args/george"
15
+ post "/cogy/cmd/empty_args/george"
16
16
  assert_equal "true", response.body
17
17
  end
18
18
 
19
19
  def test_args
20
- get "/cogy/cmd/add/george", cog_argv_0: 1, cog_argv_1: 2
20
+ post "/cogy/cmd/add/george", COG_ARGV_0: 1, COG_ARGV_1: 2
21
21
  assert_equal "3", response.body
22
22
  end
23
23
  end
@@ -7,30 +7,30 @@ module Cogy
7
7
  setup { @routes = Engine.routes }
8
8
 
9
9
  def test_error_response_code
10
- get "/cogy/cmd/raiser/george"
10
+ post "/cogy/cmd/raiser/george"
11
11
  assert_equal 500, response.status
12
12
  end
13
13
 
14
14
  def test_calc_command
15
- get "/cogy/cmd/calc/george", cog_opt_op: "+", cog_argv_0: 1, cog_argv_1: 2
15
+ post "/cogy/cmd/calc/george", COG_OPT_OP: "+", COG_ARGV_0: 1, COG_ARGV_1: 2
16
16
  assert_equal "Hello george, the answer is: 3", response.body
17
17
 
18
- get "/cogy/cmd/calc/george", cog_opt_op: "/", cog_argv_0: 10, cog_argv_1: 5
18
+ post "/cogy/cmd/calc/george", COG_OPT_OP: "/", COG_ARGV_0: 10, COG_ARGV_1: 5
19
19
  assert_equal "Hello george, the answer is: 2", response.body
20
20
  end
21
21
 
22
22
  def test_command_not_found
23
- get "/cogy/cmd/idontexist/foo"
23
+ post "/cogy/cmd/idontexist/foo"
24
24
  assert_equal 404, response.status
25
25
  end
26
26
 
27
27
  def test_cogy_env
28
- get "/cogy/cmd/print_env/george", cogy_foo: "bar"
29
- assert_equal "bar", response.body
28
+ post "/cogy/cmd/print_env/george", foo: "ha", COG_FOO: "baz", FOO: "foo"
29
+ assert_equal "ha baz foo", response.body
30
30
  end
31
31
 
32
32
  def test_rails_url_helpers
33
- get "/cogy/cmd/rails_url_helpers/george"
33
+ post "/cogy/cmd/rails_url_helpers/george"
34
34
  assert_equal "http://dummy.com/baz /baz", response.body
35
35
  end
36
36
 
@@ -45,8 +45,13 @@ module Cogy
45
45
  end
46
46
 
47
47
  def test_args_ordering
48
- get "/cogy/cmd/args_order/george", cog_argv_2: 3, cog_argv_1: 2, cog_argv_0: 1
48
+ post "/cogy/cmd/args_order/george", COG_ARGV_2: 3, COG_ARGV_1: 2, COG_ARGV_0: 1
49
49
  assert_equal "123", response.body
50
50
  end
51
+
52
+ def test_opts_downcased_and_indifferent_access
53
+ post "/cogy/cmd/test_opts_downcased/george", COG_OPT_A: "foo"
54
+ assert_equal "foo", response.body
55
+ end
51
56
  end
52
57
  end
@@ -7,13 +7,13 @@ module Cogy
7
7
  setup { @routes = Engine.routes }
8
8
 
9
9
  def test_error_tmpl_message
10
- get "/cogy/cmd/raiser/george"
10
+ post "/cogy/cmd/raiser/george"
11
11
  assert response.body.include?("boom")
12
12
  assert response.body.include?("@george")
13
13
  end
14
14
 
15
15
  def test_error_tmpl_contenttype
16
- get "/cogy/cmd/raiser/george"
16
+ post "/cogy/cmd/raiser/george"
17
17
  assert_equal "text/plain", response.content_type.to_s
18
18
  end
19
19
  end
@@ -7,12 +7,12 @@ module Cogy
7
7
  setup { @routes = Engine.routes }
8
8
 
9
9
  def test_custom_helpers_can_access_default_helpers
10
- get "/cogy/cmd/foohelper/george", cogy_foo: "bar"
10
+ post "/cogy/cmd/foohelper/george", cog_foo: "bar"
11
11
  assert_equal "bar", response.body
12
12
  end
13
13
 
14
14
  def test_custom_helper_with_arguments
15
- get "/cogy/cmd/titleize/george"
15
+ post "/cogy/cmd/titleize/george"
16
16
  assert_equal "This Should Be Titleized", response.body
17
17
  end
18
18
  end
@@ -7,7 +7,7 @@ module Cogy
7
7
  setup { @routes = Engine.routes }
8
8
 
9
9
  def test_json_output_and_default_template
10
- get "/cogy/cmd/simple_json/george"
10
+ post "/cogy/cmd/simple_json/george"
11
11
 
12
12
  expected = "COG_TEMPLATE: simple_json\n" \
13
13
  "JSON\n" \
@@ -17,7 +17,7 @@ module Cogy
17
17
  end
18
18
 
19
19
  def test_custom_template
20
- get "/cogy/cmd/custom_template/hyu"
20
+ post "/cogy/cmd/custom_template/hyu"
21
21
 
22
22
  expected = "COG_TEMPLATE: foo\n" \
23
23
  "JSON\n" \
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cogy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agis Anastasopoulos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-28 00:00:00.000000000 Z
11
+ date: 2016-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails