Permalink
Fetching contributors…
Cannot retrieve contributors at this time
163 lines (109 sloc) 4.88 KB
*0.2.0.pre.3*
* ISSUE: Whelp, needed to account for parent contexts being ActionController handlers. Fixed [jaknowlden]
*0.2.0.pre.2*
* When rails does redirects, it does not set action_controller.instance as you might expect; users should still have access to the response, though. This fixes that [jaknowlden]
*0.2.0.pre.1*
* Actually relying on riot-0.11.1. Whoops. [jaknowlden]
*0.2.0.pre*
* Using latest middleware construct from Riot 0.11.1. Also using eigen-class for hijacking local_run in the transactional, active record middleware. [jaknowlden]
* Bumping version up arbitrarily in order to move it past the previous 0.1.0 that we hijacked from @dasch :) [jaknowlden]
*0.0.10.pre.3*
* Renamed to riot-rails and am hoping @dasch is kind of enough to let me be an owner on the gem he originally pushed. The ol' bait and and switch. [jaknowlden]
* Added asserts_response context macro. You can also provide method names to be called against the response. [jaknowlden]
context FoosController do
setup { get "/foos" }
asserts_response.exists
asserts_response(:status).equals(200)
asserts_response(:body).matches(/Bar baz/)
end # FoosController
* Added GET support for ActionController testing, a la Rack testing methods. [jaknowlden]
context MyController do
setup { get "/my/dashboard", "foo" => "bar" }
end # MyController
* Redoing support for ActionController. Dropped everything started from scratch. Also, moved the context-helper stuff into Riot and called it ContextMiddleware. Reimplemented helpers as middleware here. [jaknowlden]
*0.0.9.pre*
* To accommodate the last change, added concept of context helpers. It's so simple you can define your own. [jaknowlden]
module RiotRails
register_context_helper do
def prepare_context(original_description, context)
# ...
context.<do-something-before-the-context-runs-if-you-want-to>
# ...
end
end
end
* Well. Aren't we special? We don't have include ActiveRecord or ActionController code if we don't want to. But if you do: [jaknowlden]
# teststrap.rb
require 'riot/activerecord' # implicit riot/rails require
require 'riot/actioncontroller' # also an implicit riot/rails require
* Added asserts_request and asserts_response context macros. They also take a possible method to call.
[jaknowlden]
rails_context UsersController do
hookup { get :show, :id => 1 }
asserts_response.kind_of(ActionController::TestResponse)
asserts_response(:body).kind_of(String)
asserts_request.kind_of(ActionController::TestRequest)
asserts_request(:cookies).kind_of(Hash)
end
* Controller assertions now no longer assume the actual value is a controller instance. Instead, the actual
value is something that should quack like a response. [jaknowlden]
* Added asserts_assigned context macro [jaknowlden]
rails_context UsersController do
hookup { get :show, :id => 1 }
asserts_assigned(:user).kind_of(User)
end
* rails_context now recognizes controllers [jaknowlden]
rails_context RoomsController do
hookup { get :index }
asserts_controller.reponse_status :ok
end
Plus, you can only use controlling within a rails_context now
rails_context "rooms" do
controlling :rooms
hookup { get :index }
asserts_controller.reponse_status :ok
end
* controlling now lets you pass a controller class reference in [jaknowlden]
rails_context "rooms" do
controlling RoomsController
end
* Reflection macros now test the options [emschwar]
rails_context Room do
asserts_topic.has_one :floor, :class_name => "Surface"
asserts_topic.has_many :walls, :join_table => "foos"
end
* Added the has_one reflection macro [emschwar]
rails_context Room do
asserts_topic.has_one :floor
end
* Added the attribute_is_invalid validation macro [jaknowlden]
rails_context Room do
hookup { topic.location = nil }
asserts_topic.attribute_is_invalid(:location, "can't be blank")
end
* Added validates_length_of assertion macro (minimalistic) [jaknowlden]
rails_context Room do
asserts_topic.validates_length_of :name, (2..36)
end
* Added transactional support to RailsContext. Disabled by default [jaknowlden]
rails_context Room do
set :transactional, true
end
* Added option enabling to RailsContext [jaknowlden]
rails_context Room do
set :this, "that"
end
* Added initial #rails_context. Assumes ActiveRecord class for now [jaknowlden]
class Room < ActiveRecord::Base
# ...
end
# TEST
rails_context Room do
asserts_topic.belongs_to(:house)
asserts_topic.validates_presence_of(:house_id)
end
* Added the #belongs_to ActiveRecord assertion macro [jaknowlden]
context "a Room" do
setup { Room.new }
asserts_topic.belongs_to(:house)
end