This file contains hidden or 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 'test_helper' | |
| class TestDynamic < Test::Unit::TestCase | |
| def setup; end | |
| def teardown; end | |
| def test_method1; end | |
| def test_method2; end | |
| end |
This file contains hidden or 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 AnotherModel do | |
| it "should process a fixture" do | |
| ap expected = AnotherModel.human_attribute_name('expected_countries') | |
| index = 0 | |
| country_fixture.each_line do |line| | |
| line.should match expected[index] | |
| index += 1 |
This file contains hidden or 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 AnotherModel do | |
| it "should process a fixture" do | |
| expected = ["Zimbabwe", "Tibet", "Equador"] | |
| index = 0 | |
| country_fixture.each_line do |line| | |
| line.should match expected[index] | |
| index += 1 |
This file contains hidden or 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 OurModel < ActiveRecord::Base | |
| # ... snip ... | |
| # | |
| def generate_csv_template(account_id) | |
| csv_headers = OurModel.human_attribute_name("csv_template_headers") | |
| headers = CustomModel.find_all_by_account_id(account_id).map(&:name) | |
| CSV.generate do |csv| |
This file contains hidden or 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
| en: | |
| our_model: | |
| explanation_text: "Welcome to the site!" |
This file contains hidden or 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 OurModel < ActiveRecord::Base | |
| # ... snip ... | |
| def generate_csv_template(account_id) | |
| headers = <<HEADERS | |
| first_name,last_name,birth_date,pet_name | |
| HEADERS | |
| headers += CustomModel.find_all_by_account_id(account_id). | |
| map(&:name).join(",") |
This file contains hidden or 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 'date' | |
| require 'active_support' | |
| require 'awesome_print' | |
| load 'lib/gibbon.rb' | |
| def broken_test | |
| g = Gibbon.new("API-KEY") | |
| ge = g.get_exporter | |
| list_id = "" |
This file contains hidden or 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 label=(temp_label) | |
| #self.email_label = current_account.email_labels.find_or_create_by_name(temp_label) | |
| label = EmailLabel.find_or_create_by_name_and_account_id(temp_label.downcase, account.id) | |
| self.email_label = label | |
| end |
This file contains hidden or 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 Foo < ActiveRecord::Base | |
| #... | |
| end | |
| class Bar < Foo | |
| serialize :foo | |
| end | |
| def edit | |
| foo = Foo.find(1) # => Bar(id: 1) |
This file contains hidden or 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
| [["websites", /website/i], ["emails", /email/i], ["phones", /phone|fax|cell/i]].each do |getter_data| | |
| data_type, regex = *getter_data |