wizardz 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -18,5 +18,5 @@ coverage
18
18
  rdoc
19
19
  pkg
20
20
  nbproject
21
-
21
+ patch
22
22
  ## PROJECT::SPECIFIC
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.3.0
@@ -13,6 +13,7 @@ module Wizardz
13
13
 
14
14
  def initialize(fund_data={},state=nil)
15
15
  state = self.states.first if state.nil?
16
+ raise "Invalid State ':merge' is reservered state" if self.states.include?(:merge)
16
17
  state = state.to_sym
17
18
  raise "Invalid State Assignment: #{state}" unless self.states.include?(state)
18
19
  self.load_data(fund_data)
@@ -16,7 +16,21 @@ describe "Page" do
16
16
  it "calls new for each subclass" do
17
17
  page_data = {:first_state => {:value => 'test'}}
18
18
  page = Wizardz::Page::First.new
19
- Wizardz::Page::First.should_receive(:new).with({:value => 'test'}).and_return(page)
19
+ Wizardz::Page::First.should_receive(:new).with({:value => 'test'}, nil).and_return(page)
20
+ Wizardz::Page.load_pages([:first_state], page_data, mock(Wizardz::Wizard, :classes => [Wizardz::Page::First]))
21
+ end
22
+
23
+ it "sets the merge flag to TRUE is part of passed dataset" do
24
+ page_data = {:first_state => {:value => 'test'}, :merge => true}
25
+ page = Wizardz::Page::First.new
26
+ Wizardz::Page::First.should_receive(:new).with({:value => 'test'}, true).and_return(page)
27
+ Wizardz::Page.load_pages([:first_state], page_data, mock(Wizardz::Wizard, :classes => [Wizardz::Page::First]))
28
+ end
29
+
30
+ it "sets the merge flag to FALSE is part of passed dataset" do
31
+ page_data = {:first_state => {:value => 'test'}, :merge => false}
32
+ page = Wizardz::Page::First.new
33
+ Wizardz::Page::First.should_receive(:new).with({:value => 'test'}, false).and_return(page)
20
34
  Wizardz::Page.load_pages([:first_state], page_data, mock(Wizardz::Wizard, :classes => [Wizardz::Page::First]))
21
35
  end
22
36
 
@@ -46,6 +60,7 @@ describe "Page" do
46
60
  page = Wizardz::Page::First.new({:value => 'test'})
47
61
  page.page_data.should == {:value => 'test'}
48
62
  end
63
+
49
64
  context 'update' do
50
65
  it "does not raise an error if no update method implemented" do
51
66
  page = TestClass3.new({})
@@ -7,6 +7,10 @@ class TestClassWiz < Wizardz::Page
7
7
  end
8
8
  end
9
9
 
10
+ class ErrorWiz < Wizardz::Wizard
11
+ STATES=[{:id => :merge, :class => Wizardz::Page::First}]
12
+ end
13
+
10
14
  class StateRedefWiz < Wizardz::Wizard
11
15
  end
12
16
 
@@ -24,6 +28,10 @@ describe "Wizard" do
24
28
  lambda{Wizardz::Wizard.new({}, :invalid_state)}.should raise_error
25
29
  end
26
30
 
31
+ it "raises an error if identifier of :merge is used any Page's" do
32
+ lambda{ErrorWiz.new()}.should raise_error
33
+ end
34
+
27
35
  it 'initialises valid states from params' do
28
36
  wiz = Wizardz::Wizard.new({:valid_states => [:first_state, :second_state]})
29
37
  wiz.valid_states.should == [:first_state, :second_state]
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wizardz}
8
- s.version = "1.2.0"
8
+ s.version = "1.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Henry"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wizardz
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 1.2.0
10
+ version: 1.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Henry