Skip to content

Commit

Permalink
extract asset_host specs
Browse files Browse the repository at this point in the history
  • Loading branch information
afeld committed Dec 29, 2014
1 parent dbdb132 commit d206c2c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 56 deletions.
28 changes: 0 additions & 28 deletions spec/lib/roadie/rails/automatic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,6 @@ def mail(options = {})
expect(email.roadie_options).to be_nil
end
end

describe "#asset_host" do
it "passes all arguments to the underlying simple accessor" do
string_host_mailer = Class.new(base_mailer) do
self.asset_host = 'http://original.com'

include Automatic
end

asset_host = string_host_mailer.asset_host
expect(asset_host).to be_a(Proc)
expect(asset_host.call('foo.png')).to eq('http://original.com')
end

it "passes all arguments to the underlying proc accessor" do
proc_host_mailer = Class.new(base_mailer) do
self.asset_host = Proc.new { |source, request|
'http://original.com'
}

include Automatic
end

asset_host = proc_host_mailer.asset_host
expect(asset_host).to be_a(Proc)
expect(asset_host.call('foo.png')).to eq('http://original.com')
end
end
end
end
end
39 changes: 39 additions & 0 deletions spec/lib/roadie/rails/css_localizer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
require 'spec_helper'

module Roadie
module Rails
describe CssLocalizer do
base_mailer = Class.new do
cattr_accessor :asset_host
end

describe "#asset_host" do
it "passes all arguments to the underlying simple accessor" do
string_host_mailer = Class.new(base_mailer) do
self.asset_host = 'http://original.com'

include CssLocalizer
end

asset_host = string_host_mailer.asset_host
expect(asset_host).to be_a(Proc)
expect(asset_host.call('foo.png')).to eq('http://original.com')
end

it "passes all arguments to the underlying proc accessor" do
proc_host_mailer = Class.new(base_mailer) do
self.asset_host = Proc.new { |source, request|
'http://original.com'
}

include CssLocalizer
end

asset_host = proc_host_mailer.asset_host
expect(asset_host).to be_a(Proc)
expect(asset_host.call('foo.png')).to eq('http://original.com')
end
end
end
end
end
28 changes: 0 additions & 28 deletions spec/lib/roadie/rails/mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,34 +56,6 @@ def mail(options = {})
expect(instance.roadie_mail).to eq("inlined email")
end
end

describe "#asset_host" do
it "passes all arguments to the underlying simple accessor" do
string_host_mailer = Class.new(base_mailer) do
self.asset_host = 'http://original.com'

include Automatic
end

asset_host = string_host_mailer.asset_host
expect(asset_host).to be_a(Proc)
expect(asset_host.call('foo.png')).to eq('http://original.com')
end

it "passes all arguments to the underlying proc accessor" do
proc_host_mailer = Class.new(base_mailer) do
self.asset_host = Proc.new { |source, request|
'http://original.com'
}

include Automatic
end

asset_host = proc_host_mailer.asset_host
expect(asset_host).to be_a(Proc)
expect(asset_host.call('foo.png')).to eq('http://original.com')
end
end
end
end
end

0 comments on commit d206c2c

Please sign in to comment.