Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated the tests to use the latest micro_mock.

  • Loading branch information...
commit eab696461c470143e8ce14038bb6f150e53512d4 1 parent 87b1987
Nathan Hopkins authored
Showing with 33 additions and 37 deletions.
  1. +6 −10 Gemfile.lock
  2. +1 −1  lib/coast/version.rb
  3. +26 −26 test/test_coast.rb
16 Gemfile.lock
View
@@ -1,26 +1,22 @@
GEM
remote: https://rubygems.org/
specs:
- activesupport (3.2.9)
+ activesupport (3.2.11)
i18n (~> 0.6)
multi_json (~> 1.0)
- celluloid (0.12.3)
- facter (>= 1.6.12)
- timers (>= 1.0.0)
coderay (1.0.8)
- facter (1.6.14)
i18n (0.6.1)
method_source (0.8.1)
- micro_mock (0.1.1)
- micro_test (0.3.0)
- celluloid
- multi_json (1.3.7)
+ micro_mock (1.0.0)
+ micro_test (0.3.5)
+ os
+ multi_json (1.5.0)
+ os (0.9.6)
pry (0.9.10)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.3.1)
slop (3.3.3)
- timers (1.0.1)
PLATFORMS
ruby
2  lib/coast/version.rb
View
@@ -1,3 +1,3 @@
module Coast
- VERSION = "0.9.6"
+ VERSION = "0.9.7"
end
52 test/test_coast.rb
View
@@ -15,21 +15,21 @@ class TestCoast < MicroTest::Test
# Creates a mock model instance [ActiveRecord::Base].
def self.mock_model
mock = MicroMock.make.new
- mock.stub(:destroy) { @destroyed = true }
- mock.stub(:destroyed?) { @destroyed }
- mock.stub(:update_attributes) { |*args| @attributes_updated = true }
- mock.stub(:save) { |*args| @saved = true }
- mock.class.stub(:find) { |*args| TestCoast.mock_model }
- mock.class.stub(:all) { (1..5).map { TestCoast.mock_model } }
+ mock.def(:destroy) { @destroyed = true }
+ mock.def(:destroyed?) { @destroyed }
+ mock.def(:update_attributes) { |*args| @attributes_updated = true }
+ mock.def(:save) { |*args| @saved = true }
+ mock.class.def(:find) { |*args| TestCoast.mock_model }
+ mock.class.def(:all) { (1..5).map { TestCoast.mock_model } }
mock
end
# Creates a mock request instance [ActionDispatch::Request].
def self.mock_request
mock = MicroMock.make.new
- mock.stub(:request) { @request ||= MicroMock.make.new }
- mock.stub(:params) { @params ||= {} }
- mock.stub(:flash) { @flash ||= {} }
+ mock.def(:request) { @request ||= MicroMock.make.new }
+ mock.def(:params) { @params ||= {} }
+ mock.def(:flash) { @flash ||= {} }
mock
end
@@ -37,29 +37,29 @@ def self.mock_request
def self.mock_controller
mock = MicroMock.make.new
mock.class.send :include, Coast
- mock.stub(:authorize!) { |*args| @authorize_invoked = true }
- mock.stub(:authorize_invoked?) { @authorize_invoked }
- mock.stub(:respond_to) { |&block| @responded = true; block.call(format) }
- mock.stub(:responded?) { @responded }
- mock.stub(:render) { |*args| @performed = @rendered = true }
- mock.stub(:performed?) { @performed }
- mock.stub(:rendered?) { @rendered }
- mock.stub(:redirect_to) { |*args| @redirected = true; render }
- mock.stub(:redirected?) { @redirected }
- mock.stub(:request) { @request ||= TestCoast.mock_request }
- mock.stub(:params) { request.params }
- mock.stub(:flash) { request.flash }
- mock.stub(:format) { @format ||= TestCoast.mock_format }
- mock.stub(:root_url) { "/" }
+ mock.def(:authorize!) { |*args| @authorize_invoked = true }
+ mock.def(:authorize_invoked?) { @authorize_invoked }
+ mock.def(:respond_to) { |&block| @responded = true; block.call(format) }
+ mock.def(:responded?) { @responded }
+ mock.def(:render) { |*args| @performed = @rendered = true }
+ mock.def(:performed?) { @performed }
+ mock.def(:rendered?) { @rendered }
+ mock.def(:redirect_to) { |*args| @redirected = true; render }
+ mock.def(:redirected?) { @redirected }
+ mock.def(:request) { @request ||= TestCoast.mock_request }
+ mock.def(:params) { request.params }
+ mock.def(:flash) { request.flash }
+ mock.def(:format) { @format ||= TestCoast.mock_format }
+ mock.def(:root_url) { "/" }
mock
end
# Creates a mock format instance [ActionController::MimeResponds::Collector].
def self.mock_format
mock = MicroMock.make.new
- mock.stub(:html) { |&block| @html = true; block.call if block }
- mock.stub(:xml) { |&block| @xml = true; block.call if block }
- mock.stub(:json) { |&block| @json = true; block.call if block }
+ mock.def(:html) { |&block| @html = true; block.call if block }
+ mock.def(:xml) { |&block| @xml = true; block.call if block }
+ mock.def(:json) { |&block| @json = true; block.call if block }
mock
end
Please sign in to comment.
Something went wrong with that request. Please try again.