Sha256: b51f8642cc845f36dbb6093ee3819a8f96f682621495d2cf9647b854b8745fd3
Contents?: true
Size: 1.64 KB
Versions: 5
Compression:
Stored size: 1.64 KB
Contents
require 'test_helper' class InvoiceBar::API::CurrenciesControllerTest < ActionController::TestCase setup do @routes = InvoiceBar::Engine.routes @user = FactoryGirl.create(:invoice_bar_user, administrator: true) @contact = FactoryGirl.create(:invoice_bar_contact, user: @user) login_user @user @currency = FactoryGirl.create(:invoice_bar_currency) end test "should get index" do get :index, format: :json assert_equal 200, response.status assert_equal [@currency].to_json, response.body end test "should create currency" do @new_currency = FactoryGirl.build(:invoice_bar_currency, name: 'Dollars', symbol: '$') assert_difference('InvoiceBar::Currency.count') do post :create, format: :json, currency: { name: @new_currency.name, symbol: @new_currency.symbol, priority: @new_currency.priority } end assert_equal 201, response.status end test "should show currency" do get :show, format: :json, id: @currency assert_equal 200, response.status assert_equal @currency.to_json, response.body end test "should update currency" do put :update, format: :json, id: @currency, currency: { name: 'New Currency', symbol: 'NC', priority: @currency.priority } assert_equal 200, response.status @currency = InvoiceBar::Currency.find(@currency.id) assert_equal 'New Currency', @currency.name assert_equal 'NC', @currency.symbol end test "should destroy currency" do assert_difference('InvoiceBar::Currency.count', -1) do delete :destroy, format: :json, id: @currency end assert_equal 200, response.status end end
Version data entries
5 entries across 5 versions & 1 rubygems