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
begin | |
response.body.scan(/(.+?)(?:\n|$)/) do |line| | |
yield ActiveSupport::JSON.decode(line) | |
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
require 'active_support' | |
require 'httparty' | |
require 'json' | |
require 'cgi' | |
class Gibbon | |
include HTTParty | |
format :plain | |
default_timeout 30 |
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
describe "Setup link visibility" do | |
["basic", "advanced"].each do |role| | |
it "should not be visible to #{role}s", :driver => :rack_test do | |
login_as(role.to_sym) do | |
visit root_path | |
page.should_not have_content("MailChimp Setup") | |
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
#defines login_as | |
require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper') | |
describe "MC Integration" do | |
describe "setup modal" do | |
# would want a | |
# before(:each) do |
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
def login | |
login_as | |
end | |
def login_as(role=:basic, &block) | |
account = Account.find_by_name("testaccount") || Factory.create(:testaccount) | |
role = Role.find_by_name(role.to_s.capitalize) || Factory.create("#{role.downcase}_role") | |
user = Factory.create(:user, :account => account, :role => role) | |
login_as_user(user,&block) |
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
Spork.each_run do | |
# This code will be run each time you run your specs. | |
`rake fuzzymatch:load_functions RAILS_ENV=test` | |
# reload classes for spork | |
ActiveSupport::Dependencies.clear | |
# re-instantiate observers | |
ActiveRecord::Base.instantiate_observers | |
# Reload FactoryGirl factories on each run |
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
class Model < ActiveRecord::Base | |
class << self | |
def method | |
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
require 'spec_helper' | |
describe ContactImport do | |
describe "Schema" do | |
it { should have_db_column(:import_file_name).of_type(:string) } | |
it { should have_db_column(:import_content_type).of_type(:string) } | |
it { should have_db_column(:import_file_size).of_type(:integer) } | |
it { should have_db_column(:import_updated_at).of_type(:datetime) } | |
it { should have_db_column(:import_format).of_type(:string) } | |
it { should have_db_column(:tag_import).of_type(:boolean) } |
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
it "creates a new ContactImport based on type" do | |
["vcard", "csv", "mailchimp"].each do |import_format| | |
import_class = ContactImport.import_mapping[import_format] | |
post :create, :contact_import => {:import_format => import_format} | |
assigns(:contact_import).should_not be_nil | |
assigns(:contact_import).should be_a_kind_of(import_class) | |
response.should redirect_to :edit_contact_import | |
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
require 'spork' | |
Spork.prefork do | |
# Loading more in this block will cause your tests to run faster. However, | |
# if you change any configuration or code from libraries loaded here, you'll | |
# 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' |
OlderNewer