Sometimes when ceiling boxes are roughed in, they use x/3 with ground cable so that they can supply 1 switched hot, 1 neural, 1 hot/switched hot, and 1 ground to the ceiling box.
![enter image description here](https://i.stack.imgur.com/5T9gW.jpg)
This allows a ceiling fan to be installed in such a way that the fan can be controlled either by a separate switch, or using only the attached pull chain. In this situation the red wire in the cable is usually disconnected and capped at both ends, and is only intended to be connected as needed.
You may be able to verify this by opening the switch box, and verifying the wiring at the switch. If this is the case and the extra hot wire is not needed, it should be disconnected and capped at both ends. Once that's complete, you can move on to determining if you have a proper grounding conductor.
Grounding Conductor
If the building was renovated/built in 2008, it's not likely the circuit does not include an ground conductor. However, there are multiple ways to satisfy the grounding conductor requirement according to NEC 2008 250.118.
- A copper, aluminium, or copper-clad aluminum conductor.
- Rigid metal conduit.
- Intermediate metal conduit.
- Electrical metallic tubing.
- Listed flexible metal conduit meeting specific conditions.
- Listed liquidtight flexible metal conduit meeting specific conditions.
- Flexible metallic tubing meeting specific conditioins.
- Armor of Type AC cable as provided in 320.108.
- The copper sheath of mineral-insulated, metal-sheathed cable.
- Type MC cable where listed and identified for grounding in accordance with specific criteria.
- Cable trays as permitted in 392.3 and 392.7.
- Cablebus framework as permitted in 370.3.
- Other listed electrically continuous metal raceways and listed auxiliary gutters.
- Surface metal raceways listed for grounding.
Checking for a Grounding Conductor
The most accurate way to verify whether or not there a proper ground connected, would be to check for continuity between the junction box and the grounding electrode system. In most situations this is not an option, so another test must be performed.
Checking Continuity to the Grounding Electrode System
To run this test you'll either have to be within reach of; or be able to run a lead to, the grounding bus in the main service panel.
- Set your multimeter to the continuity setting or the lowest
resistance setting.
![enter image description here](https://i.stack.imgur.com/i8Qyp.png)
- Place one lead on the grounding bus bar in the load center.
- Place the other lead on the junction box under test.
If the meter beeps or gives a reading close to 0, the box and the load center are electrically connected. This means there is a proper grounding conductor installed. If the meter does not beep or has a reading of infinity, the box and the load center are not electrically connected. You'll have to install an approved grounding conductor throughout this circuit, if you want proper grounding.
Checking Continuity to a Known Good Ground
If you have a known good ground nearby (from another circuit, for example), you can use this ground to test for an equipment ground at the box in question.
- Set your multimeter to the continuity setting or the lowest
resistance setting.
![enter image description here](https://i.stack.imgur.com/i8Qyp.png)
- Place one lead on the known good ground.
- Place the other lead on the junction box under test.
If the meter beeps or gives a reading close to 0, the box and the known good ground are electrically connected. This means there is a proper grounding conductor installed. If the meter does not beep or has a reading of infinity, the box and the known good ground are not electrically connected. You'll have to install an approved grounding conductor throughout this circuit, if you want proper grounding.
Check Continuity to the Grounded Conductor
If neither of these options are available, the next best option is to check for continuity between the box and the circuits grounded conductor (neutral). These two conductors should be electrically connected (bonded) at the main service panel, so checking continuity between them can (usually) determine if there is an equipment ground.
WARNING: This method relies on the circuit being installed correctly. If the grounded conductor (neutral) is (incorrectly) connected to the grounding conductor anywhere along the circuit, this test may give invalid results.
- Set your multimeter to the continuity setting or the lowest
resistance setting.
![enter image description here](https://i.stack.imgur.com/i8Qyp.png)
- Place one lead on the grounded conductor (neutral).
- Place the other lead on the junction box under test.
If the meter beeps or gives a reading close to 0, the box and the grounded conductor (neutral) are electrically connected. This means there may be a proper grounding conductor installed. If the meter does not beep or has a reading of infinity, the box and the grounded conductor (neutral) are not electrically connected. You'll have to install an approved grounding conductor throughout this circuit, if you want proper grounding.
NOTE:
All continuity testing should be carried out while the circuit is dead. Shut off power to the circuit at the breaker before working on the circuit, and verify the circuit is off using a non-contact voltage tester.
Electricity is dangerous and can lead to property damage, injury, and death. If you do not feel comfortable working with electricity, please contact a qualified Electrician.
Accessible is a somewhat relative concept. You need to fully remove a recessed fixture from a ceiling to access the connections. This is a bit more difficult than pulling a switch to get at the wires, or even dropping a canopy style fixture, but it does meet the criteria of accessible.
But one of the main rationales for the rule seems to be to ensure a troubleshooter knows where all the connection are, that none are truly buried in the walls where they can't be found.
I don't know if the code has considered your solution, but it sounds like the box you are suggesting is buried, even though it is attached to the recessed fixture. In a sense, you are modifying the fixture in a way not contemplated by the manufacturer. But it might pass muster with some inspectors since it sounds like the junction would be accessible if you removed the can.
There is another way that might suit. The code now allows for certain in-wall splices that can be buried, such as these.
![nm splice](https://i.stack.imgur.com/LdbME.jpg)
The old wire is inserted into one section of the device, clamped, and screwed in. A new wire is inserted into the other. The halves then snap together and the resultant splice can be buried in a ceiling or wall. If feasible, the completed clamp should be attached to a framing member, but I don't think the code requires it if the wire is left in an unaccessible area.
You could attach this splice to your old wire and run a short extension to your can.
Images and links are illustrative only, not an endorsement of goods or sources.
Best Answer
That's all there really is to it - white to white and black to black. If they are not color coded then the black wire should be connected to the pin at the bottom of the light socket.
This assumes your light is line voltage (120V in North America). If it is not line voltage then there should be a transformer somewhere in the fixture already.