Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the initial setup files #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.1
3.2.2
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source "https://rubygems.org"

gem "activerecord", "~> 4.1"
gem "database_cleaner"
gem "factory_girl"
gem "factory_bot"
gem "rspec", "~> 3.1"
gem "rake"
gem "sqlite3"
Expand Down
74 changes: 40 additions & 34 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,45 +1,48 @@
GEM
remote: https://rubygems.org/
specs:
activemodel (4.1.8)
activesupport (= 4.1.8)
activemodel (4.2.11.3)
activesupport (= 4.2.11.3)
builder (~> 3.1)
activerecord (4.1.8)
activemodel (= 4.1.8)
activesupport (= 4.1.8)
arel (~> 5.0.0)
activesupport (4.1.8)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
activerecord (4.2.11.3)
activemodel (= 4.2.11.3)
activesupport (= 4.2.11.3)
arel (~> 6.0)
activesupport (4.2.11.3)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (5.0.1.20140414130214)
builder (3.2.2)
database_cleaner (1.3.0)
diff-lcs (1.2.5)
factory_girl (4.5.0)
arel (6.0.4)
builder (3.2.4)
concurrent-ruby (1.2.2)
database_cleaner (1.99.0)
diff-lcs (1.5.0)
factory_girl (4.9.0)
activesupport (>= 3.0.0)
i18n (0.6.11)
json (1.8.1)
minitest (5.4.3)
rake (10.4.2)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
mini_portile2 (2.8.4)
minitest (5.19.0)
rake (13.0.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-support (3.1.2)
sqlite3 (1.3.10)
thread_safe (0.3.4)
timecop (0.7.1)
tzinfo (1.2.2)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
sqlite3 (1.6.4)
mini_portile2 (~> 2.8.0)
thread_safe (0.3.6)
timecop (0.9.8)
tzinfo (1.2.11)
thread_safe (~> 0.1)

PLATFORMS
Expand All @@ -53,3 +56,6 @@ DEPENDENCIES
rspec (~> 3.1)
sqlite3
timecop

BUNDLED WITH
2.4.19
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,15 @@ If you'd like to see a quick intro to test doubles, check out the related episod

## Instructions

To start, you'll want to clone and run the setup script for the repo
To start, you'll want to clone the repo

git clone [email protected]:thoughtbot-upcase-exercises/simple-stubs.git
cd simple-stubs


In the file `.ruby-version`, update the Ruby version according to the Ruby that runs on your machine, update the bundle, and then run the setup script for the repo.

bundle update
bin/setup

After running `bin/setup`, edit `spec/dashboard_spec.rb` and look for test logic which is duplicated from `spec/post_spec.rb`. Use `double` and `allow` to create a stub for posts and eliminate this duplication.
Expand Down
8 changes: 4 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "rspec"
require "active_record"
require "database_cleaner"
require "factory_girl"
require "factory_bot"
require "timecop"

PROJECT_ROOT = File.expand_path("../..", __FILE__)
Expand All @@ -13,7 +13,7 @@
database: File.join(PROJECT_ROOT, "test.db")
)

class CreateSchema < ActiveRecord::Migration
class CreateSchema < ActiveRecord::Migration[7.0]
def self.up
create_table :posts, force: true do |table|
table.string :title
Expand All @@ -22,7 +22,7 @@ def self.up
end
end

FactoryGirl.define do
FactoryBot.define do
sequence(:title) { |n| "title#{n}text" }

factory :post do
Expand All @@ -31,7 +31,7 @@ def self.up
end

RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.include FactoryBot::Syntax::Methods

config.before(:suite) do
CreateSchema.suppress_messages { CreateSchema.migrate(:up) }
Expand Down