Created
April 27, 2013 23:25
-
-
Save steveklabnik/5475159 to your computer and use it in GitHub Desktop.
shared examples in MiniTest As usual, "Just Use Ruby"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
describe "foo" do | |
include SupportsCount | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SupportsCount | |
describe "#count" do | |
it "is a dummy test for this example" do | |
assert true | |
end | |
end | |
end |
wojtekmach
commented
May 15, 2013
For only one it per module? I don't see the point (even if it supports more than one).
Fixed version: https://gist.github.com/wojtekmach/5583628
@zenspider you probably already know that, but I was actually surprised that getting 95% use cases of shared examples with spec DSL is as simple as:
class Module
include Minitest::Spec::DSL
end
module SupportsCount
it 'responds to count' do
end
end
it
, before
, after
just works. It's kind of beautiful it's so simple. describe
doesn't work but who cares.
@steveklabnik sorry for bombing your gist :p
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment