spec/controllers/account_controller_spec.rb in iugusdk-1.0.0.alpha.3 vs spec/controllers/account_controller_spec.rb in iugusdk-1.0.0.alpha.4
- old
+ new
@@ -33,22 +33,32 @@
end
context "destroy" do
login_as_user
- context "when using right id" do
- before do
- get :destroy, :id => @user.accounts.first.id
- end
+ context "when enable_account_cancel == true" do
+ context "and using right id" do
+ before do
+ IuguSDK::enable_account_cancel = true
+ get :destroy, :id => @user.accounts.first.id
+ end
- it { response.should redirect_to account_settings_path }
+ it { response.should redirect_to account_settings_path }
- it 'should start destruction job' do
- @user.accounts.first.destroying?.should be_true
+ it 'should start destruction job' do
+ @user.accounts.first.destroying?.should be_true
+ end
end
end
+ context "when enable_account_cancel == false" do
+ it 'should raise RoutingError' do
+ IuguSDK::enable_account_cancel = false
+ lambda{ get :destroy, :id => @user.accounts.first.id }.should raise_error ActionController::RoutingError
+ end
+ end
+
end
context "cancel_destruction" do
login_as_user
before do
@@ -114,11 +124,12 @@
context "generate_new_token" do
login_as_user
before(:each) do
IuguSDK::enable_account_api = true
+ IuguSDK::account_api_tokens = [ 'test' ]
@account = @user.accounts.last
- post :generate_new_token, :account_id => @account.id
+ post :generate_new_token, :account_id => @account.id, :description => 'token x', :api_type => 'test'
end
it { response.should redirect_to account_view_path(@account.id) }
it { flash.now[:notice].should == I18n.t("iugu.notices.new_token_generated") }