diff --git a/Gemfile b/Gemfile index 5e67234..64230df 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index 59b95f5..4a3e1ff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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) @@ -216,6 +217,7 @@ DEPENDENCIES rspec-rails sass-rails (~> 5.0) sdoc (~> 0.4.0) + shoulda-context spring sqlite3 turbolinks @@ -223,4 +225,4 @@ DEPENDENCIES web-console (~> 2.0) BUNDLED WITH - 1.10.6 + 1.11.2 diff --git a/test/shoulda_context/calculator_test.rb b/test/shoulda_context/calculator_test.rb new file mode 100644 index 0000000..f844c0b --- /dev/null +++ b/test/shoulda_context/calculator_test.rb @@ -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