Revisions
-
reinh revised this gist
Mar 15, 2013 . 1 changed file with 13 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,14 +3,20 @@ describe Coderetreat do describe ".running_today" do subject { Coderetreat.running_today } def coderetreat_on(date) Coderetreat.create! city: "Chicago", scheduled_on: date end context 'with a coderetreat scheduled for today' do let(:coderetreat) { coderetreat_on Date.today } it { should include coderetreat } end context 'with a coderetreat not scheduled for today' do let(:coderetreat) { coderetreat_on Date.today.advance(:days => -1) } it { should_not include coderetreat } end end end -
coreyhaines revised this gist
Dec 3, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ require 'active_record' require 'database_cleaner' connection_info = YAML.load_file("config/database.yml")["test"] ActiveRecord::Base.establish_connection(connection_info) RSpec.configure do |config| -
coreyhaines revised this gist
Aug 5, 2012 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,7 @@ #Replace this line config.use_transactional_fixtures = true #With this require 'active_record_spec_helper' #TADA -
coreyhaines revised this gist
Aug 4, 2012 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ #Some databases get upset if you try to start a new transaction while a transaction is already in play, so running the whole spec suite chokes when rspec is trying to start a transaction. You need to update your spec_helper to rely on active_record_spec_helper to do this for you. #Replace this line config.use_transactional_fixtures = true #With these require 'database_cleaner' require 'active_record_spec_helper' #TADA -
coreyhaines revised this gist
Aug 4, 2012 . No changes.There are no files selected for viewing
-
coreyhaines revised this gist
Mar 18, 2012 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ --colour -I app -
coreyhaines revised this gist
Mar 18, 2012 . 2 changed files with 21 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ class Coderetreat < ActiveRecord::Base def self.running_today where(scheduled_on: Date.today) 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ require 'active_record_spec_helper' require 'models/coderetreat' describe Coderetreat do describe ".running_today" do it "returns a coderetreat scheduled for today" do coderetreat = Coderetreat.create! city: "Chicago", scheduled_on: Date.today Coderetreat.running_today.all.should =~ [coderetreat] end it "does not return a coderetreat not scheduled for today" do coderetreat = Coderetreat.create! city: "Chicago", scheduled_on: Date.today.advance(:days => -1) Coderetreat.running_today.should be_empty end end end -
coreyhaines created this gist
Mar 18, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ require 'active_record' require 'database_cleaner' connection_info = YAML.load(File.open("config/database.yml"))["test"] ActiveRecord::Base.establish_connection(connection_info) RSpec.configure do |config| config.before(:suite) do DatabaseCleaner.strategy = :transaction DatabaseCleaner.clean_with(:truncation) end config.before(:each) do DatabaseCleaner.start end config.after(:each) do DatabaseCleaner.clean end end