Daniel, what you tried:

f[x_ /; x <= 2] := 1f[x_ /; x > 2] := 2

?f

Integrate[f[t], {t, 0, 3}]

didn't get, what you wanted

_____________________________________________________________________________

Roman Mäder's definitions from Chapter 8 "Overriding Built-in Rule" p.186f of "Programming in Mathematica" (second edition)
(don't forget the argument is considered to be real now!)

Unprotect[Abs]

Abs[x_]  :=  x  /;  Positive[x]Abs[x_]  :=  -x  /;  Negative[x]

Abs /:  Abs'  =  Sign

Unprotect[Sign]

Sign[0]  =  IndeterminateSign'[x_]  :=  0  /;  x !=  0Sign'[0]  =  Indeterminate

Sign /:  x_ Sign[x_]  :=  Abs[x]

Abs /:  Integrate[Abs[x_],  x_]  :=  x Abs[x]/2Sign /:  Integrate[Sign[x_],  x_]  :=  Abs[x]

Protect[Abs,  Sign]

_____________________________________________________________________________

Roman Mäder's examples:

Integrate[ Integrate[Sign[t], t], t]

D[%,  {t, 2}]

Abs''[x]

_____________________________________________________________________________

Now Daniel, comes your Function:

Remove[g]

g[x_]  :=  3/2  +  1/2  Sign[x - 2]

Integrate[g[t], {t, 0, 3}]

_____________________________________________________________________________

For practical use I'd advice to define a function more handy, e.g.

Step[x_,  {yStep_,  xStep_}]  :=  
      yStep/2 (1  +  Sign[x  -  xStep])

Now if you have a spectrum (of data)

data  =  {{1,  1/2},  {1/2,  1},  {1/4,  3/2},  {1/8,  2}}

Just Map Step over it!

Remove[f]

f[x_]  :=  
      Evaluate[Plus @@ ( Step[x,  #]& /@ data )]

Evaluate for performance, and don't forget the parentheses after @@!

Plot[f[t],  {t, 0,  2.5}];

Integrate[f[t],  {t, 0,  5/2}]