roadie-rails 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +9 -1
  3. data/codecov.yml +3 -0
  4. data/lib/roadie/rails/version.rb +1 -1
  5. data/roadie-rails.gemspec +3 -1
  6. metadata +5 -200
  7. data/spec/integration_spec.rb +0 -91
  8. data/spec/lib/roadie/rails/asset_pipeline_provider_spec.rb +0 -77
  9. data/spec/lib/roadie/rails/automatic_spec.rb +0 -54
  10. data/spec/lib/roadie/rails/document_builder_spec.rb +0 -20
  11. data/spec/lib/roadie/rails/mail_inliner_spec.rb +0 -92
  12. data/spec/lib/roadie/rails/mailer_spec.rb +0 -57
  13. data/spec/lib/roadie/rails/options_spec.rb +0 -172
  14. data/spec/lib/roadie/rails/railtie_spec.rb +0 -61
  15. data/spec/railsapps/README.md +0 -66
  16. data/spec/railsapps/rails_42/.gitignore +0 -16
  17. data/spec/railsapps/rails_42/Gemfile +0 -5
  18. data/spec/railsapps/rails_42/app/assets +0 -1
  19. data/spec/railsapps/rails_42/app/mailers +0 -1
  20. data/spec/railsapps/rails_42/app/views +0 -1
  21. data/spec/railsapps/rails_42/bin/rails +0 -4
  22. data/spec/railsapps/rails_42/config.ru +0 -4
  23. data/spec/railsapps/rails_42/config/application.rb +0 -16
  24. data/spec/railsapps/rails_42/config/boot.rb +0 -4
  25. data/spec/railsapps/rails_42/config/environment.rb +0 -5
  26. data/spec/railsapps/rails_42/config/environments/development.rb +0 -9
  27. data/spec/railsapps/rails_42/config/initializers/secret_token.rb +0 -1
  28. data/spec/railsapps/rails_42/config/initializers/session_store.rb +0 -1
  29. data/spec/railsapps/rails_42/config/routes.rb +0 -2
  30. data/spec/railsapps/rails_42_sprockets_rails_3/.gitignore +0 -16
  31. data/spec/railsapps/rails_42_sprockets_rails_3/Gemfile +0 -6
  32. data/spec/railsapps/rails_42_sprockets_rails_3/app/assets +0 -1
  33. data/spec/railsapps/rails_42_sprockets_rails_3/app/mailers +0 -1
  34. data/spec/railsapps/rails_42_sprockets_rails_3/app/views +0 -1
  35. data/spec/railsapps/rails_42_sprockets_rails_3/bin/rails +0 -4
  36. data/spec/railsapps/rails_42_sprockets_rails_3/config.ru +0 -4
  37. data/spec/railsapps/rails_42_sprockets_rails_3/config/application.rb +0 -13
  38. data/spec/railsapps/rails_42_sprockets_rails_3/config/boot.rb +0 -4
  39. data/spec/railsapps/rails_42_sprockets_rails_3/config/environment.rb +0 -5
  40. data/spec/railsapps/rails_42_sprockets_rails_3/config/environments/development.rb +0 -9
  41. data/spec/railsapps/rails_42_sprockets_rails_3/config/initializers/assets.rb +0 -1
  42. data/spec/railsapps/rails_42_sprockets_rails_3/config/initializers/secret_token.rb +0 -1
  43. data/spec/railsapps/rails_42_sprockets_rails_3/config/initializers/session_store.rb +0 -1
  44. data/spec/railsapps/rails_42_sprockets_rails_3/config/routes.rb +0 -2
  45. data/spec/railsapps/rails_50/.gitignore +0 -21
  46. data/spec/railsapps/rails_50/Gemfile +0 -7
  47. data/spec/railsapps/rails_50/app/assets +0 -1
  48. data/spec/railsapps/rails_50/app/mailers/auto_mailer.rb +0 -27
  49. data/spec/railsapps/rails_50/app/mailers/mailer.rb +0 -17
  50. data/spec/railsapps/rails_50/app/views +0 -1
  51. data/spec/railsapps/rails_50/bin/rails +0 -4
  52. data/spec/railsapps/rails_50/config.ru +0 -9
  53. data/spec/railsapps/rails_50/config/application.rb +0 -16
  54. data/spec/railsapps/rails_50/config/boot.rb +0 -3
  55. data/spec/railsapps/rails_50/config/environment.rb +0 -5
  56. data/spec/railsapps/rails_50/config/environments/development.rb +0 -12
  57. data/spec/railsapps/rails_50/config/initializers/assets.rb +0 -11
  58. data/spec/railsapps/rails_50/config/initializers/cookies_serializer.rb +0 -4
  59. data/spec/railsapps/rails_50/config/initializers/request_forgery_protection.rb +0 -4
  60. data/spec/railsapps/rails_50/config/initializers/session_store.rb +0 -3
  61. data/spec/railsapps/rails_50/config/routes.rb +0 -6
  62. data/spec/railsapps/rails_51/.gitignore +0 -17
  63. data/spec/railsapps/rails_51/Gemfile +0 -8
  64. data/spec/railsapps/rails_51/app/assets/images/rails.png +0 -0
  65. data/spec/railsapps/rails_51/app/assets/stylesheets/email.css.scss +0 -2
  66. data/spec/railsapps/rails_51/app/mailers/auto_mailer.rb +0 -27
  67. data/spec/railsapps/rails_51/app/mailers/mailer.rb +0 -17
  68. data/spec/railsapps/rails_51/app/views/auto_mailer/normal_email.html.erb +0 -11
  69. data/spec/railsapps/rails_51/app/views/auto_mailer/normal_email.text +0 -1
  70. data/spec/railsapps/rails_51/app/views/mailer/normal_email.html.erb +0 -11
  71. data/spec/railsapps/rails_51/app/views/mailer/normal_email.text +0 -1
  72. data/spec/railsapps/rails_51/bin/rails +0 -4
  73. data/spec/railsapps/rails_51/config.ru +0 -5
  74. data/spec/railsapps/rails_51/config/application.rb +0 -16
  75. data/spec/railsapps/rails_51/config/boot.rb +0 -3
  76. data/spec/railsapps/rails_51/config/environment.rb +0 -5
  77. data/spec/railsapps/rails_51/config/environments/development.rb +0 -51
  78. data/spec/railsapps/rails_51/config/environments/production.rb +0 -83
  79. data/spec/railsapps/rails_51/config/environments/test.rb +0 -42
  80. data/spec/railsapps/rails_51/config/initializers/application_controller_renderer.rb +0 -6
  81. data/spec/railsapps/rails_51/config/initializers/assets.rb +0 -11
  82. data/spec/railsapps/rails_51/config/initializers/backtrace_silencers.rb +0 -7
  83. data/spec/railsapps/rails_51/config/initializers/cookies_serializer.rb +0 -5
  84. data/spec/railsapps/rails_51/config/initializers/filter_parameter_logging.rb +0 -4
  85. data/spec/railsapps/rails_51/config/initializers/inflections.rb +0 -16
  86. data/spec/railsapps/rails_51/config/initializers/mime_types.rb +0 -4
  87. data/spec/railsapps/rails_51/config/initializers/new_framework_defaults.rb +0 -21
  88. data/spec/railsapps/rails_51/config/initializers/session_store.rb +0 -3
  89. data/spec/railsapps/rails_51/config/initializers/wrap_parameters.rb +0 -9
  90. data/spec/railsapps/rails_51/config/locales/en.yml +0 -23
  91. data/spec/railsapps/rails_51/config/routes.rb +0 -3
  92. data/spec/railsapps/rails_51/log/.keep +0 -0
  93. data/spec/railsapps/shared/all/app/mailers/auto_mailer.rb +0 -27
  94. data/spec/railsapps/shared/all/app/mailers/mailer.rb +0 -17
  95. data/spec/railsapps/shared/all/app/views/auto_mailer +0 -1
  96. data/spec/railsapps/shared/all/app/views/mailer/normal_email.html.erb +0 -11
  97. data/spec/railsapps/shared/all/app/views/mailer/normal_email.text +0 -1
  98. data/spec/railsapps/shared/pipeline/app/assets/images/rails.png +0 -0
  99. data/spec/railsapps/shared/pipeline/app/assets/stylesheets/email.css.scss +0 -2
  100. data/spec/spec_helper.rb +0 -18
  101. data/spec/support/have_no_styling_matcher.rb +0 -25
  102. data/spec/support/have_selector_matcher.rb +0 -3
  103. data/spec/support/have_styling_matcher.rb +0 -63
  104. data/spec/support/rails_app.rb +0 -78
@@ -1,3 +0,0 @@
1
- Rails.application.routes.draw do
2
- # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
3
- end
File without changes
@@ -1,27 +0,0 @@
1
- class AutoMailer < ActionMailer::Base
2
- include Roadie::Rails::Automatic
3
-
4
- default from: 'john@example.com'
5
-
6
- def normal_email
7
- generate_email
8
- end
9
-
10
- def disabled_email
11
- generate_email
12
- end
13
-
14
- private
15
- def roadie_options
16
- unless action_name =~ /disabled/
17
- super.combine(url_options: {protocol: "https"})
18
- end
19
- end
20
-
21
- def generate_email
22
- mail(to: 'example@example.org', subject: "Notification for you") do |format|
23
- format.html { render :normal_email }
24
- format.text { render :normal_email }
25
- end
26
- end
27
- end
@@ -1,17 +0,0 @@
1
- class Mailer < ActionMailer::Base
2
- include Roadie::Rails::Mailer
3
-
4
- default from: 'john@example.com'
5
-
6
- def normal_email
7
- roadie_mail(to: 'example@example.org', subject: "Notification for you") do |format|
8
- format.html
9
- format.text
10
- end
11
- end
12
-
13
- private
14
- def roadie_options
15
- super.combine(url_options: {protocol: "https"})
16
- end
17
- end
@@ -1 +0,0 @@
1
- spec/railsapps/shared/all/app/views/mailer
@@ -1,11 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv="content-type" content="text/html; charset=utf-8">
5
- <%= stylesheet_link_tag "email" %>
6
- </head>
7
- <body>
8
- <h1>Normal email</h1>
9
- <div class="image"></div>
10
- </body>
11
- </html>
@@ -1,2 +0,0 @@
1
- body { background-color: green; }
2
- .image { background: image-url("rails.png"); }
@@ -1,18 +0,0 @@
1
- require "rspec/collection_matchers"
2
-
3
- if ENV['CI'] &&
4
- RUBY_ENGINE != 'rbx' # coverage is extremely slow on Rubinius
5
- require 'simplecov'
6
- SimpleCov.start
7
-
8
- require 'codecov'
9
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
10
- end
11
-
12
- require 'roadie-rails'
13
-
14
- RSpec.configure do |config|
15
- config.run_all_when_everything_filtered = true
16
- end
17
-
18
- Dir['./spec/support/**/*.rb'].each { |file| require file }
@@ -1,25 +0,0 @@
1
- RSpec::Matchers.define :have_no_styling do
2
- chain(:at_selector) { |selector| @selector = selector }
3
-
4
- match { |document|
5
- @selector ||= 'body > *:first'
6
- styles_at_selector(document).empty?
7
- }
8
-
9
- description {
10
- "have no styles at selector #{@selector.inspect}"
11
- }
12
-
13
- failure_message { |document|
14
- "expected no styles at #{@selector.inspect} but had:\n#{styles_at_selector(document)}"
15
- }
16
-
17
- failure_message_when_negated {
18
- "expected #{@selector.inspect} to have styles"
19
- }
20
-
21
- def styles_at_selector(document)
22
- expect(document).to have_selector(@selector)
23
- document.at_css(@selector)['style'] || ""
24
- end
25
- end
@@ -1,3 +0,0 @@
1
- RSpec::Matchers.define :have_selector do |selector|
2
- match { |dom| dom.at_css selector }
3
- end
@@ -1,63 +0,0 @@
1
- RSpec::Matchers.define :have_styling do |rules|
2
- normalized_rules = StylingExpectation.new(rules)
3
-
4
- chain(:at_selector) { |selector| @selector = selector }
5
-
6
- match { |document|
7
- @selector ||= 'body > *:first'
8
- normalized_rules == styles_at_selector(document)
9
- }
10
-
11
- description {
12
- "have styles #{normalized_rules.inspect} at selector #{@selector.inspect}"
13
- }
14
-
15
- failure_message { |document|
16
- "expected styles at #{@selector.inspect} to be:\n#{normalized_rules}\nbut was:\n#{styles_at_selector(document)}"
17
- }
18
-
19
- failure_message_when_negated {
20
- "expected styles at #{@selector.inspect} to not be:\n#{normalized_rules}"
21
- }
22
-
23
- def styles_at_selector(document)
24
- expect(document).to have_selector(@selector)
25
- style = document.at_css(@selector)['style']
26
- StylingExpectation.new(style || "")
27
- end
28
- end
29
-
30
- class StylingExpectation
31
- def initialize(styling)
32
- case styling
33
- when String then @rules = parse_rules(styling)
34
- when Array then @rules = styling
35
- when Hash then @rules = styling.to_a
36
- else fail "I don't understand #{styling.inspect}!"
37
- end
38
- end
39
-
40
- def ==(other)
41
- rules == other.rules
42
- end
43
-
44
- def to_s() rules.to_s end
45
-
46
- protected
47
- attr_reader :rules
48
-
49
- private
50
- def parse_rules(css)
51
- css.split(';').map { |property| parse_property(property) }
52
- end
53
-
54
- def parse_property(property)
55
- rule, value = property.split(':', 2).map(&:strip)
56
- [rule, normalize_quotes(value)]
57
- end
58
-
59
- # JRuby's Nokogiri encodes quotes
60
- def normalize_quotes(string)
61
- string.gsub '%22', '"'
62
- end
63
- end
@@ -1,78 +0,0 @@
1
- class RailsApp
2
- def initialize(name, path, options = {})
3
- @name = name
4
- @path = File.expand_path("../../railsapps/#{path}", __FILE__)
5
- @runner = options.fetch(:runner)
6
- @using_asset_pipeline = options.fetch(:asset_pipeline)
7
- @digests = options.fetch(:digests)
8
- @sprockets = options[:sprockets]
9
- reset
10
- end
11
-
12
- def to_s() @name end
13
- def using_asset_pipeline?() @using_asset_pipeline end
14
- def digested?() @digests end
15
- def sprockets3_or_later?() @sprockets && @sprockets >= 3 end
16
-
17
- def read_email(mail_name)
18
- result = run("puts Mailer.#{mail_name}.to_s")
19
- raise "No email returned. Did the rails application crash?" if result.strip.empty?
20
- Mail.read_from_string(result)
21
- end
22
-
23
- def read_delivered_email(mail_name, options = {})
24
- deliver = options[:force_delivery] ? "deliver!" : "deliver"
25
- result = run("mail = AutoMailer.#{mail_name}; mail.delivery_method(:test); mail.#{deliver}; puts mail.to_s")
26
- raise "No email returned. Did the rails application crash?" if result.strip.empty?
27
- Mail.read_from_string(result)
28
- end
29
-
30
- def read_providers
31
- result = run(<<-RUBY).strip
32
- providers = Rails.application.config.roadie.asset_providers
33
- puts providers.map { |p| p.class.name }.join(',')
34
- RUBY
35
- raise "No output present. Did the application crash?" if result.empty?
36
- result.split(",")
37
- end
38
-
39
- def reset
40
- @extra_code = ""
41
- run_in_app_context 'rm -rf tmp/cache'
42
- end
43
-
44
- def before_mail(code)
45
- @extra_code << "\n" << code << "\n"
46
- end
47
-
48
- private
49
- def run(code)
50
- Tempfile.open('code') do |file|
51
- file << @extra_code unless @extra_code.empty?
52
- file << code
53
- file.close
54
- run_file_in_app_context file.path
55
- end
56
- end
57
-
58
- def run_file_in_app_context(file_path)
59
- run_in_app_context "#{runner_script} #{file_path.shellescape}"
60
- end
61
-
62
- def run_in_app_context(command)
63
- Bundler.with_clean_env do
64
- Dir.chdir @path do
65
- IO.popen(command).read
66
- end
67
- end
68
- end
69
-
70
- def runner_script
71
- case @runner
72
- when :script then "script/rails runner"
73
- when :bin then "bin/rails runner"
74
- else raise "Unknown runner type: #{@runner}"
75
- end
76
- end
77
- end
78
-