cogy 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/app/controllers/cogy/application_controller.rb +2 -1
- data/app/controllers/cogy/cogy_controller.rb +7 -8
- data/config/routes.rb +1 -1
- data/lib/cogy/version.rb +1 -1
- data/test/dummy/cogy/foo.rb +7 -1
- data/test/dummy/config/initializers/cogy.rb +1 -1
- data/test/dummy/log/test.log +2372 -0
- data/test/integration/builtin_helpers_test.rb +3 -3
- data/test/integration/command_test.rb +13 -8
- data/test/integration/error_template_test.rb +2 -2
- data/test/integration/helpers_test.rb +2 -2
- data/test/integration/json_response_test.rb +2 -2
- metadata +2 -2
@@ -7,17 +7,17 @@ module Cogy
|
|
7
7
|
setup { @routes = Engine.routes }
|
8
8
|
|
9
9
|
def test_args_helper_overrides_predefined_helpers
|
10
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
29
|
-
assert_equal "
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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.
|
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-
|
11
|
+
date: 2016-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|