Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #5 from berlin-ab/also
Cleaned up my branch for Also.
  • Loading branch information
robb1e committed May 13, 2013
2 parents 5208cd5 + 45b12f6 commit d1a61a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 8 additions & 0 deletions Rakefile
@@ -1 +1,9 @@
task :bundle_install do
system("bundle")
end

require "bundler/gem_tasks"
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

task :default => [:bundle_install, :spec]
4 changes: 1 addition & 3 deletions lib/simple_bdd.rb
@@ -1,13 +1,11 @@
require "simple_bdd/version"

module SimpleBdd

%w[Given When Then And].each do |method|
%w[Given When Then And Also].each do |method|
define_method(method) do |message|
send message.downcase.gsub(" ", "_").gsub(/\W/, "")
end

alias_method method.downcase, method
end

end
5 changes: 2 additions & 3 deletions spec/simple_bdd_spec.rb
Expand Up @@ -5,11 +5,10 @@ class SimpleBddExample
end

describe SimpleBddExample do

let(:subject) { SimpleBddExample.new }

describe "#given, #when, #then, #and" do
["given", "when", "then", "and", "Given", "When", "Then", "And"].each do |method|
describe "#given, #when, #then, #and, #also" do
["given", "when", "then", "and", "Given", "When", "Then", "And", "Also", "also"].each do |method|
it "calls the method after translating the string" do
subject.should_receive(:something_something_darkside)
subject.send(method, "Something, Something Darkside")
Expand Down

0 comments on commit d1a61a4

Please sign in to comment.