spec/lunetas/candy_spec.rb in lunetas-0.1.1 vs spec/lunetas/candy_spec.rb in lunetas-0.1.2
- old
+ new
@@ -71,9 +71,30 @@
it 'should set another ContentType' do
TestClass.send(:set_content_type, 'text/plain')
@instance.bite[1]["Content-Type"].should == "text/plain"
end
+ it 'should be able to change the ContentType per instance' do
+ @instance.set_content_type 'application/json'
+ @instance.bite[1]["Content-Type"].should == 'application/json'
+ end
+
+ it 'should be able to set a custom Header' do
+ @instance.set_header 'Chunky', 'bacon'
+ @instance.bite[1]['Chunky'].should == 'bacon'
+ end
+
+ it 'should be able to add a custom Header with a symbol' do
+ @instance.set_header :Chunky, 'bacon'
+ @instance.bite[1]['Chunky'].should == 'bacon'
+ end
+
+ it 'should keep the last Header set' do
+ @instance.set_header :Chunky, 'bacon'
+ @instance.set_header 'Chunky', 'b4c0n'
+ @instance.bite[1]['Chunky'].should == 'b4c0n'
+ end
+
it 'should be able to redirect' do
mock_env = mock_env('/just_a_test')
mock_env['REQUEST_METHOD'] = 'REDIRECT'
@instance = TestClass.new(mock_env, ['/just_a_test'])
@instance.bite[1].keys.should include('Location')