-
-
Save jferris/5111428 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'products/_prime_purchase.html.erb' do | |
it "tries to sell the user on Prime" do | |
view.stubs(currently_viewing_subscription_product?: false) | |
view.stubs(current_user_has_active_subscription?: false) | |
view.stubs(subscription_product: stub('subscription_product', name: 'foo')) | |
render template: 'products/_prime_purchase' | |
rendered.should include(I18n.t('shared.subscription_call_to_action')) | |
end | |
it "does not sell the user on Prime if they're subscribed already" do | |
view.stubs(currently_viewing_subscription_product?: false) | |
view.stubs(current_user_has_active_subscription?: true) | |
view.stubs(subscription_product: stub('subscription_product')) | |
render template: 'products/_prime_purchase' | |
rendered.should_not include(I18n.t('shared.subscription_call_to_action')) | |
end | |
it "does not sell the user on Prime if they're currently viewing Prime's product show page" do | |
view.stubs(currently_viewing_subscription_product?: true) | |
render template: 'products/_prime_purchase' | |
rendered.should_not include(I18n.t('shared.subscription_call_to_action')) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if !currently_viewing_subscription_product? %> | |
<% if subscription_product && !current_user_has_active_subscription? %> | |
<h2>Access this and all our other products by subscribing to <%= subscription_product.name %></h2> | |
<div class="license"> | |
<%= link_to product_path(subscription_product), | |
class: 'license-button button' do %> | |
Get unlimited access | |
<% end %> | |
</div> | |
<% end %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment