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 'Signing in', vcr: { match_requests_on: [:path] } do | |
before do | |
@user = create :user | |
visit '/users/sign_in' | |
fill_in 'Email', with: @user.email | |
fill_in 'Password', with: @user.password | |
click_button 'Sign in' |
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 Account < ActiveRecord::Base | |
attr_accessible :name, | |
:account_type, | |
:balance | |
def self.import(file, account_importer = CsvAccountImporter.new) | |
account_importer.import file | |
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
class Account < ActiveRecord::Base | |
attr_accessible :name, | |
:account_type, | |
:balance | |
def self.import(file, account_importer) | |
account_importer.import file | |
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 'Importing accounts' do | |
context 'given a CSV file of accounts' do | |
before do | |
visit '/' | |
within '#new_accounts' do | |
attach_file 'File', Rails.root.join('spec', 'fixtures', 'accounts.csv') | |
click_button 'Import' | |
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
$ cucumber features/pig_latin.feature | |
Using the default profile... | |
.F- | |
(::) failed steps (::) | |
Exit status was 1 but expected it to be 0. Output: | |
/Users/jared/Projects/translator/lib/translator.rb:12:in `initialize': wrong number of arguments (0 for 1) (ArgumentError) |
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
Feature: Pig Latin | |
In order to amuse others or conceal the meaning of some text | |
As a user | |
I want to be able to translate from English to Pig Latin | |
Scenario: Translating English to Pig Latin | |
Given a file of English text | |
When I ask to translate it to Pig Latin | |
Then I should see it in Pig Latin |
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 Loan < ActiveRecord::Base | |
def self.pending | |
where state: 'pending' | |
end | |
def self.delinquent | |
where('expires_on < ?', Time.zone.today) | |
.where('repaid = ?', false) | |
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
$ rake test:pattern[point] | |
Test 'test_point.c' | |
------------------- | |
Compiling point.c... | |
Linking test_point.out... | |
Running test_point.out... | |
------------------------- | |
OVERALL UNIT TEST SUMMARY |
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
#include "point.h" | |
struct point MakePoint(int x, int y) | |
{ | |
struct point pt; | |
pt.x = x; | |
pt.y = y; | |
return pt; | |
} |
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
$ gem install ceedling |
NewerOlder