forked from alexpeachey/striped_rails
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
7,197 additions
and
1,438 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Gemfile.lock |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
class UserMailer < ActionMailer::Base | ||
default from: "from@example.com" | ||
module StripedRails | ||
class UserMailer < ActionMailer::Base | ||
default from: "from@example.com" | ||
|
||
def invoice(user, invoice) | ||
@user = UserDecorator.decorate(user) | ||
@invoice = InvoiceDecorator.new(invoice) | ||
mail(to: user.email, subject: "Brand Invoice") | ||
end | ||
def invoice(user, invoice) | ||
@user = UserDecorator.decorate(user) | ||
@invoice = InvoiceDecorator.new(invoice) | ||
mail(to: user.email, subject: "Brand Invoice") | ||
end | ||
|
||
def password_reset(user, token) | ||
@password_token = token | ||
mail to: user.email, subject: 'Password Reset' | ||
def password_reset(user, token) | ||
@password_token = token | ||
mail to: user.email, subject: 'Password Reset' | ||
end | ||
end | ||
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'spec_helper' | ||
|
||
module StripedRails | ||
describe BaseDecorator do | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
require 'spec_helper' | ||
|
||
describe CouponDecorator do | ||
before { ApplicationController.new.set_current_view_context } | ||
end | ||
module StripedRails | ||
describe CouponDecorator do | ||
before { BaseController.new.set_current_view_context } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
require 'spec_helper' | ||
|
||
describe PageDecorator, :draper_with_helpers do | ||
include Rails.application.routes.url_helpers | ||
module StripedRails | ||
|
||
describe PageDecorator, :draper_with_helpers do | ||
include Rails.application.routes.url_helpers | ||
|
||
describe "#menu" do | ||
context "when we have 5 pages" do | ||
before :each do | ||
@pages = (1..5).map { PageDecorator.new(Factory(:page)) } | ||
end | ||
describe "#menu" do | ||
context "when we have 5 pages" do | ||
before :each do | ||
@pages = (1..5).map { PageDecorator.new(Factory(:page)) } | ||
end | ||
|
||
it "should produce a menu with a top level title element" do | ||
@pages.first.menu(@pages).should include "<a href=\"#\" class=\"dropdown-toggle\"" | ||
end | ||
it "should produce a menu with a top level title element" do | ||
@pages.first.menu(@pages).should include "<a href=\"#\" class=\"dropdown-toggle\"" | ||
end | ||
|
||
it "should produce menu items for each page" do | ||
@pages.first.menu(@pages).should include @pages[0].title | ||
@pages.first.menu(@pages).should include @pages[1].title | ||
it "should produce menu items for each page" do | ||
@pages.first.menu(@pages).should include @pages[0].title | ||
@pages.first.menu(@pages).should include @pages[1].title | ||
end | ||
end | ||
end | ||
|
||
end | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,54 @@ | ||
require 'spec_helper' | ||
|
||
describe SubscriptionPlanDecorator, :draper_with_helpers do | ||
include Rails.application.routes.url_helpers | ||
|
||
describe "#price" do | ||
it "should provide the price in currency format" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan, amount: 999)) | ||
subscription_plan.price.should == "$9.99 per month" | ||
module StripedRails | ||
describe SubscriptionPlanDecorator, :draper_with_helpers do | ||
include Rails.application.routes.url_helpers | ||
|
||
describe "#price" do | ||
it "should provide the price in currency format" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan, amount: 999)) | ||
subscription_plan.price.should == "$9.99 per month" | ||
end | ||
end | ||
end | ||
|
||
describe "#monthly_revenue" do | ||
it "should format the monthly_revenue" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan, amount: 1000)) | ||
subscription_plan.monthly_revenue.should == "$0.00" | ||
describe "#monthly_revenue" do | ||
it "should format the monthly_revenue" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan, amount: 1000)) | ||
subscription_plan.monthly_revenue.should == "$0.00" | ||
end | ||
end | ||
end | ||
|
||
describe "#users_count" do | ||
it "should format the users_count" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan)) | ||
subscription_plan.users_count.should == "0 Users" | ||
describe "#users_count" do | ||
it "should format the users_count" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan)) | ||
subscription_plan.users_count.should == "0 Users" | ||
end | ||
end | ||
end | ||
|
||
describe "#trial_information" do | ||
it "should provide human readable trial information" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan, trial_period_days: 30)) | ||
subscription_plan.trial_information.should == '<p><span class="label label-success">30 day free trial!</span></p>' | ||
end | ||
describe "#trial_information" do | ||
it "should provide human readable trial information" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan, trial_period_days: 30)) | ||
subscription_plan.trial_information.should == '<p><span class="label label-success">30 day free trial!</span></p>' | ||
end | ||
|
||
it "should return an empty string when no trial" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan, trial_period_days: 0)) | ||
subscription_plan.trial_information.should == "" | ||
end | ||
end | ||
|
||
describe "#unit_information" do | ||
it "should provide human readable unit information" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan, unit_name: 'Button Push', included_units: '10', overage_price: '10')) | ||
subscription_plan.unit_information.should include 'Button Push' | ||
subscription_plan.unit_information.should include '$0.10' | ||
it "should return an empty string when no trial" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan, trial_period_days: 0)) | ||
subscription_plan.trial_information.should == "" | ||
end | ||
end | ||
|
||
it "should return an empty string when unit usage is not being used" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan)) | ||
subscription_plan.unit_information.should == '' | ||
describe "#unit_information" do | ||
it "should provide human readable unit information" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan, unit_name: 'Button Push', included_units: '10', overage_price: '10')) | ||
subscription_plan.unit_information.should include 'Button Push' | ||
subscription_plan.unit_information.should include '$0.10' | ||
end | ||
|
||
it "should return an empty string when unit usage is not being used" do | ||
subscription_plan = SubscriptionPlanDecorator.decorate(Factory(:subscription_plan)) | ||
subscription_plan.unit_information.should == '' | ||
end | ||
end | ||
end | ||
end | ||
|
||
end |
Oops, something went wrong.