Skip to content

Commit

Permalink
add Turnip::Define to all modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jnicklas committed Apr 24, 2012
1 parent 9ca6c86 commit 464606e
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 12 deletions.
2 changes: 0 additions & 2 deletions examples/steps/alignment_steps.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
module Alignment
extend Turnip::Define

attr_accessor :alignment

step "that alignment should be :alignment" do |expected_alignment|
Expand Down
4 changes: 0 additions & 4 deletions examples/steps/dragon_steps.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require_relative "knight_steps"

module DragonSteps
extend Turnip::Define

include KnightSteps

attr_accessor :dragon
Expand All @@ -21,8 +19,6 @@ def dragon_attack
end

module RedDragonSteps
extend Turnip::Define

include DragonSteps

attr_accessor :red_dragon
Expand Down
2 changes: 0 additions & 2 deletions examples/steps/knight_steps.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
module KnightSteps
extend Turnip::Define

attr_accessor :knight

class Knight
Expand Down
3 changes: 2 additions & 1 deletion lib/turnip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class Ambiguous < StandardError; end
# your tests.
#
module Steps
extend Define
end

class << self
Expand All @@ -36,6 +35,8 @@ def load_steps
Turnip.type = :turnip
Turnip.step_dirs = ['spec']

Module.send(:include, Turnip::Define)

self.extend Turnip::DSL

require "turnip/rspec"
1 change: 0 additions & 1 deletion lib/turnip/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def steps_for(tag, &block)
else
Module.new do
singleton_class.send(:define_method, :tag) { tag }
extend Turnip::Define
module_eval(&block)
::RSpec.configure { |c| c.include self, tag => true }
end
Expand Down
4 changes: 2 additions & 2 deletions spec/define_and_execute.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "spec_helper"

describe Turnip::Define do
let(:mod) { Module.new { extend Turnip::Define } }
describe Turnip::Execute do
let(:mod) { Module.new }
let(:obj) { Object.new.tap { |o| o.extend Turnip::Execute; o.extend mod } }

it "defines a step method and makes it callable" do
Expand Down

0 comments on commit 464606e

Please sign in to comment.