hat-trick 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,30 +12,32 @@ describe HatTrick::Wizard do
12
12
  HatTrick::Wizard.new(wiz_def)
13
13
  }
14
14
 
15
+ let(:wizard) { subject }
16
+
15
17
  before :each do
16
- subject.start
18
+ wizard.start
17
19
  end
18
20
 
19
21
  describe "advancing steps" do
20
22
  it "should go from step1 to step2" do
21
- subject.current_step.to_sym.should == :step1
22
- subject.advance_step
23
- subject.current_step.to_sym.should == :step2
23
+ wizard.current_step.to_sym.should == :step1
24
+ wizard.advance_step
25
+ wizard.current_step.to_sym.should == :step2
24
26
  end
25
27
  end
26
28
 
27
29
  describe "skipping steps" do
28
30
  it "should skip step2 when requested" do
29
- subject.skip_step :step2
30
- subject.advance_step
31
- subject.current_step.to_sym.should == :step3
31
+ wizard.skip_step :step2
32
+ wizard.advance_step
33
+ wizard.current_step.to_sym.should == :step3
32
34
  end
33
35
 
34
36
  it "should skip steps 2 & 3 when requested" do
35
- subject.skip_step :step2
36
- subject.skip_step :step3
37
- subject.advance_step
38
- subject.current_step.to_sym.should == :step4
37
+ wizard.skip_step :step2
38
+ wizard.skip_step :step3
39
+ wizard.advance_step
40
+ wizard.current_step.to_sym.should == :step4
39
41
  end
40
42
  end
41
43
 
@@ -46,19 +48,19 @@ describe HatTrick::Wizard do
46
48
 
47
49
  describe "setting explicit next steps" do
48
50
  it "should advance to the requested next step when one is set" do
49
- subject.steps.first.next_step = :step4
50
- subject.advance_step
51
- subject.current_step.to_sym.should == :step4
51
+ wizard.steps.first.next_step = :step4
52
+ wizard.advance_step
53
+ wizard.current_step.to_sym.should == :step4
52
54
  end
53
55
  end
54
56
 
55
57
  describe "#previously_visited_step" do
56
58
  it "should return the most recently visited step" do
57
- subject.steps[0].visited = true
58
- subject.steps[1].visited = true
59
- subject.steps[3].visited = true
60
- subject.current_step = :step5
61
- subject.previously_visited_step.to_sym.should == :step4
59
+ wizard.steps[0].visited = true
60
+ wizard.steps[1].visited = true
61
+ wizard.steps[3].visited = true
62
+ wizard.current_step = :step5
63
+ wizard.previously_visited_step.to_sym.should == :step4
62
64
  end
63
65
  end
64
66
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  ENV["RAILS_ENV"] ||= 'test'
2
2
  require 'bundler/setup'
3
+ require 'rails'
3
4
  require 'logger'
4
5
 
5
6
  module Rails
@@ -10,15 +11,6 @@ module Rails
10
11
  def self.logger
11
12
  @logger ||= ::Logger.new(STDOUT).tap { |l| l.level = ::Logger::ERROR }
12
13
  end
13
-
14
- class Engine
15
- def self.initializer(*args, &block); end
16
- end
17
- end
18
-
19
- module ActionController
20
- class Base
21
- end
22
14
  end
23
15
 
24
16
  require File.expand_path('../../lib/hat-trick', __FILE__)