Skip to content

Commit

Permalink
Minor Code Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesChevalier committed Dec 7, 2013
1 parent e17cac2 commit 69385e6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
6 changes: 3 additions & 3 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def interested
unless @ref.blank? # Increment RCOUNT for referrer if referral code is present
begin
list_members = mailchimp.lists.members("#{MAILCHIMP_LIST_ID}")
referring_member = list_members['data'].detect{ |member| member['merges']['RCODE'] == "#{@ref}" }
referring_member = list_members['data'].detect { |member| member['merges']['RCODE'] == "#{@ref}" }
new_count = referring_member['merges']['RCOUNT'] + 1
mailchimp.lists.update_member("#{MAILCHIMP_LIST_ID}", {"euid" => "#{referring_member['id']}"}, 'RCOUNT' => "1")
mailchimp.lists.update_member("#{MAILCHIMP_LIST_ID}", {'euid' => "#{referring_member['id']}"}, 'RCOUNT' => '1')
rescue => e
flash.now[:alert] = 'There was a problem updating the referral at MailChimp'
return render :index
Expand All @@ -47,7 +47,7 @@ def interested

begin
mailchimp.lists.subscribe("#{MAILCHIMP_LIST_ID}",
{"email" => "#{email}"},
{'email' => "#{email}"},
{'RCODE' => "#{@referral_code}", 'RCOUNT' => "0"})
rescue => e
flash.now[:alert] = 'There was a problem subscribing you to the list on MailChimp'
Expand Down
14 changes: 7 additions & 7 deletions spec/controllers/home_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
require 'spec_helper'

describe HomeController do
describe "GET index" do
it "renders index" do
describe 'GET index' do
it 'renders index' do
get :index
response.should be_success
end
end

describe "GET interested" do
context "with an email address" do
it "renders interested" do
describe 'GET interested' do
context 'with an email address' do
it 'renders interested' do
get 'interested', {:email => Faker::Internet.email}
response.should be_success
end
end

context "without an email address" do
it "redirects to the homepage" do
context 'without an email address' do
it 'redirects to the homepage' do
get 'interested'
response.should redirect_to(root_url)
end
Expand Down
10 changes: 5 additions & 5 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
# need to restart spork for it take effect.

# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
Expand All @@ -27,7 +27,7 @@

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }

RSpec.configure do |config|
# ## Mock Framework
Expand Down Expand Up @@ -56,9 +56,9 @@
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
config.order = 'random'

config.include Capybara::DSL, :type => :request
config.include Capybara::DSL, type: :request
config.include FactoryGirl::Syntax::Methods

# https://ariejan.net/2011/09/24/rspec-speed-up-by-tweaking-ruby-garbage-collection
Expand Down
2 changes: 0 additions & 2 deletions spec/support/deferred_garbage_collection.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# https://ariejan.net/2011/09/24/rspec-speed-up-by-tweaking-ruby-garbage-collection

class DeferredGarbageCollection

DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || 15.0).to_f
Expand All @@ -17,5 +16,4 @@ def self.reconsider
@@last_gc_run = Time.now
end
end

end

0 comments on commit 69385e6

Please sign in to comment.