Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

macros approach to requestable examples as expressed in http://mutuallyhuman.com/blog/2012/01/27/rspec-requestable-examples

View gist:1700352
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
module WordListMacros
def it_strips_double_quotes
it "strips double quotes" do
subject.list_of_words = %w("foo" "bar")
subject.list_of_words.should eq(%w(foo bar))
end
end
def it_strips_single_quotes
it "strips single quotes" do
subject.list_of_words = %w('foo' 'bar')
subject.list_of_words.should eq(%w(foo bar))
end
end
def it_allows_standard_non_alphanumeric_chars
it "allows '!, ?, @, #, $, %, &, *, -, +, _ :, .' characters" do
...
end
end
end
 
describe FirstWordList do
extend WordListMacros
it_strips_single_quotes
it_strips_double_quotes
...
end
 
describe SecondWordList do
extend WordListMacros
it_strips_double_quotes
it_allows_standard_non_alphanumeric_chars
...
it 'does something special to SecondWordList'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.