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

Add shoulda-context and example tests #1

Open
wants to merge 1 commit 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: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,7 @@ group :test do
gem 'cucumber-rails', :require => false
# database_cleaner is not required, but highly recommended
gem 'database_cleaner'

gem 'shoulda-context'
end

8 changes: 5 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ~/Documents/github/knapsack-pro/knapsack
specs:
knapsack (1.6.0)
knapsack (1.7.0)
rake
timecop (>= 0.1.0)

Expand Down Expand Up @@ -171,6 +171,7 @@ GEM
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
shoulda-context (1.2.1)
slop (3.6.0)
spring (1.3.6)
sprockets (3.5.2)
Expand All @@ -184,7 +185,7 @@ GEM
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
timecop (0.8.0)
timecop (0.8.1)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
Expand Down Expand Up @@ -216,11 +217,12 @@ DEPENDENCIES
rspec-rails
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
shoulda-context
spring
sqlite3
turbolinks
uglifier (>= 1.3.0)
web-console (~> 2.0)

BUNDLED WITH
1.10.6
1.11.2
27 changes: 27 additions & 0 deletions test/shoulda_context/calculator_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require 'test_helper'

class Calculator
def sum(x, y)
x + y
end

def product(x, y)
x * y
end
end

class CalculatorTest < ActiveSupport::TestCase
context "a calculator" do
setup do
@calculator = Calculator.new
end

should "add two numbers for the sum" do
assert_equal 4, @calculator.sum(2, 2)
end

should "multiply two numbers for the product" do
assert_equal 10, @calculator.product(2, 5)
end
end
end