|
100 | 100 | it { hash[:param7].should == nil } |
101 | 101 | it { hash[:param8].should == nil } |
102 | 102 |
|
103 | | - context "returns nil if the param doesn't exists" do |
104 | | - subject { BigBlueButton::BigBlueButtonFormatter.new({ :param => 1}) } |
105 | | - it { subject.to_datetime(:inexistent).should == nil } |
106 | | - end |
| 103 | + context "returns nil if" do |
| 104 | + context "the param doesn't exists" do |
| 105 | + subject { BigBlueButton::BigBlueButtonFormatter.new({ :param => 1}) } |
| 106 | + it { subject.to_datetime(:inexistent).should == nil } |
| 107 | + end |
107 | 108 |
|
108 | | - context "returns nil if the hash is nil" do |
109 | | - subject { BigBlueButton::BigBlueButtonFormatter.new(nil) } |
110 | | - it { subject.to_datetime(:inexistent).should == nil } |
| 109 | + context "the hash is nil" do |
| 110 | + subject { BigBlueButton::BigBlueButtonFormatter.new(nil) } |
| 111 | + it { subject.to_datetime(:inexistent).should == nil } |
| 112 | + end |
| 113 | + |
| 114 | + context "the value is an empty string" do |
| 115 | + subject { BigBlueButton::BigBlueButtonFormatter.new({ param1: '' }) } |
| 116 | + it { subject.to_datetime(:param1).should == nil } |
| 117 | + end |
| 118 | + |
| 119 | + context "the value is nil" do |
| 120 | + subject { BigBlueButton::BigBlueButtonFormatter.new({ param1: nil }) } |
| 121 | + it { subject.to_datetime(:param1).should == nil } |
| 122 | + end |
| 123 | + |
| 124 | + context "the value is an empty hash" do |
| 125 | + subject { BigBlueButton::BigBlueButtonFormatter.new({ param1: {} }) } |
| 126 | + it { subject.to_datetime(:param1).should == nil } |
| 127 | + end |
| 128 | + |
| 129 | + context "the value is an empty array" do |
| 130 | + subject { BigBlueButton::BigBlueButtonFormatter.new({ param1: [] }) } |
| 131 | + it { subject.to_datetime(:param1).should == nil } |
| 132 | + end |
| 133 | + |
| 134 | + ['null', 'NULL'].each do |v| |
| 135 | + context "the value is '#{v}'" do |
| 136 | + subject { BigBlueButton::BigBlueButtonFormatter.new({ param1: v }) } |
| 137 | + it { subject.to_datetime(:param1).should == nil } |
| 138 | + end |
| 139 | + end |
111 | 140 | end |
112 | 141 | end |
113 | 142 |
|
|
0 commit comments