hoboken 0.0.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/dependabot.yml +7 -0
- data/.github/workflows/ruby.yml +28 -0
- data/.rubocop.yml +33 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/IDEAS.md +57 -0
- data/LICENSE.txt +1 -1
- data/README.md +21 -10
- data/Rakefile +14 -6
- data/bin/hoboken +2 -1
- data/hoboken.gemspec +53 -16
- data/lib/hoboken.rb +110 -23
- data/lib/hoboken/actions.rb +10 -6
- data/lib/hoboken/add_ons/github_action.rb +14 -0
- data/lib/hoboken/add_ons/heroku.rb +8 -23
- data/lib/hoboken/add_ons/internationalization.rb +10 -6
- data/lib/hoboken/add_ons/metrics.rb +39 -14
- data/lib/hoboken/add_ons/omniauth.rb +114 -47
- data/lib/hoboken/add_ons/rubocop.rb +40 -0
- data/lib/hoboken/add_ons/sequel.rb +76 -47
- data/lib/hoboken/add_ons/sprockets.rb +67 -65
- data/lib/hoboken/add_ons/travis.rb +6 -2
- data/lib/hoboken/add_ons/twbs.rb +80 -0
- data/lib/hoboken/generate.rb +112 -38
- data/lib/hoboken/templates/Gemfile.erb.tt +33 -10
- data/lib/hoboken/templates/README.md.tt +105 -35
- data/lib/hoboken/templates/Rakefile.tt +10 -22
- data/lib/hoboken/templates/classic.rb.tt +35 -8
- data/lib/hoboken/templates/config.ru.tt +5 -3
- data/lib/hoboken/templates/console.sh +5 -0
- data/lib/hoboken/templates/db.rb.tt +24 -0
- data/lib/hoboken/templates/github_action.tt +28 -0
- data/lib/hoboken/templates/gitignore +8 -1
- data/lib/hoboken/templates/metrics.rake.tt +10 -9
- data/lib/hoboken/templates/modular.rb.tt +40 -11
- data/lib/hoboken/templates/puma.rb.tt +21 -0
- data/lib/hoboken/templates/rspec.rake.tt +5 -0
- data/lib/hoboken/templates/rubocop.yml.tt +31 -0
- data/lib/hoboken/templates/sequel.rake +6 -4
- data/lib/hoboken/templates/server.sh +12 -0
- data/lib/hoboken/templates/setup.sh +7 -0
- data/lib/hoboken/templates/spec/app_spec.rb.tt +15 -0
- data/lib/hoboken/templates/spec/rack_matchers.rb.tt +56 -0
- data/lib/hoboken/templates/spec/spec_helper.rb.tt +41 -0
- data/lib/hoboken/templates/sprockets.rake +13 -7
- data/lib/hoboken/templates/sprockets_chain.rb +7 -3
- data/lib/hoboken/templates/sprockets_helper.rb +14 -10
- data/lib/hoboken/templates/support/rack_helpers.rb.tt +55 -0
- data/lib/hoboken/templates/support/rack_test_assertions.rb.tt +111 -0
- data/lib/hoboken/templates/test/test_helper.rb.tt +38 -27
- data/lib/hoboken/templates/test/unit/app_test.rb.tt +11 -3
- data/lib/hoboken/templates/test_unit.rake.tt +18 -0
- data/lib/hoboken/templates/views/index.erb.tt +10 -3
- data/lib/hoboken/templates/views/layout.erb.tt +4 -1
- data/lib/hoboken/version.rb +3 -1
- data/test/fixtures/Gemfile +3 -3
- data/test/fixtures/Gemfile.pristine +3 -2
- data/test/integration/add_on_test.rb +399 -136
- data/test/integration/generate_test.rb +170 -38
- data/test/test_helper.rb +54 -23
- data/test/unit/hoboken_actions_test.rb +70 -61
- metadata +441 -16
- data/.travis.yml +0 -5
- data/lib/hoboken/templates/test/support/rack_test_assertions.rb.tt +0 -92
data/.travis.yml
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
module Rack::Test::Assertions
|
2
|
-
RESPONSE_CODES = {
|
3
|
-
:ok => 200,
|
4
|
-
:not_authorized => 401,
|
5
|
-
:not_found => 404,
|
6
|
-
:redirect => 302
|
7
|
-
}
|
8
|
-
|
9
|
-
CONTENT_TYPES = {
|
10
|
-
:json => "application/json;charset=utf-8",
|
11
|
-
:html => "text/html;charset=utf-8"
|
12
|
-
}
|
13
|
-
|
14
|
-
def assert_body_contains(expected, message=nil)
|
15
|
-
msg = build_message(message, "expected body to contain <?>\n#{last_response.body}", expected)
|
16
|
-
assert_block(msg) do
|
17
|
-
last_response.body.include?(expected)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def assert_content_type(content_type)
|
22
|
-
unless CONTENT_TYPES.keys.include?(content_type)
|
23
|
-
raise ArgumentError, "unrecognized content_type (#{content_type})"
|
24
|
-
end
|
25
|
-
|
26
|
-
assert_equal CONTENT_TYPES[content_type], last_response.content_type
|
27
|
-
end
|
28
|
-
|
29
|
-
def assert_flash(type=:notice, message=nil)
|
30
|
-
msg = build_message(message, "expected <?> flash to exist, but was nil", type.to_s)
|
31
|
-
assert_block(msg) do
|
32
|
-
last_request.env['rack.session']['flash']
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def assert_flash_message(expected, type=:notice, message=nil)
|
37
|
-
assert_flash(type, message)
|
38
|
-
flash = last_request.env['rack.session']['flash'][type.to_s]
|
39
|
-
msg = build_message(message, "expected flash to be <?> but was <?>", expected, flash)
|
40
|
-
assert_block(msg) do
|
41
|
-
expected == flash
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def assert_has_session(message=nil)
|
46
|
-
msg = build_message(message, "expected a valid session")
|
47
|
-
assert_block(msg) do
|
48
|
-
last_request.env["rack.session"]
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def assert_session_has_key(key, message=nil)
|
53
|
-
assert_has_session
|
54
|
-
msg = build_message(message, "expected session to have key named <?>", key)
|
55
|
-
assert_block(msg) do
|
56
|
-
last_request.env["rack.session"].keys.include?(key.to_s)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def assert_session(key, expected, message=nil)
|
61
|
-
assert_session_has_key(key)
|
62
|
-
actual = last_request.env["rack.session"][key.to_s]
|
63
|
-
msg = build_message(message, "expected session key <?> to be <?>, but was <?>", key, expected, actual)
|
64
|
-
assert_block(msg) do
|
65
|
-
expected == actual
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def assert_response(expected, message=nil)
|
70
|
-
status = last_response.status
|
71
|
-
msg = build_message(
|
72
|
-
message,
|
73
|
-
"expected last response to be <?> but was <?>",
|
74
|
-
"#{RESPONSE_CODES[expected]}:#{expected}",
|
75
|
-
"#{status}:#{RESPONSE_CODES.key(status)}"
|
76
|
-
)
|
77
|
-
|
78
|
-
assert_block(msg) do
|
79
|
-
status == RESPONSE_CODES[expected]
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def assert_redirected_to(expected, msg=nil)
|
84
|
-
assert_response(:redirect)
|
85
|
-
actual = URI(last_response.location).path
|
86
|
-
msg = build_message(message, "expected to be redirected to <?> but was <?>", expected, actual)
|
87
|
-
|
88
|
-
assert_block(msg) do
|
89
|
-
expected == actual
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|