<commit_before>
require 'spec_helper'

describe Freenect::Device do
  before(:all) do
    (@ctx = Freenect.init()).should be_kind_of(Freenect::Context)
    @ctx.num_devices.should >= 1
    (@dev = @ctx.open_device(0)).should be_kind_of(Freenect::Device)
  end

  after(:all) do
    @dev.set_tilt_degrees(0)
    @dev.set_led(:off)
    @dev.close
    @ctx.close
  end

  it "should indicate whether it is in a closed state" do
    @dev.should_not be_closed
  end

  it "should retain a reference to its parent context" do
    ctx = @dev.context()
    ctx.should_not be_nil
    ctx.should be_kind_of(Freenect::Context)
    ctx.should == @ctx
  end

  it "should indicate its current tilt state" do
    tilt_state = @dev.tilt_state
    tilt_state.should be_kind_of(Freenect::RawTiltState)
  end

  it "should indicate it's current tilt angle" do<commit_msg>simplify and sane-ify before/after clauses<commit_after>
require 'spec_helper'

describe Freenect::Device do
  before(:all) do
    @ctx = Freenect.init()
    @dev = @ctx.open_device(0)
  end

  after(:all) do
    @dev.set_tilt_degrees(0) if @dev
    @dev.set_led(:off) if @dev
    @dev.close if @dev
    @ctx.close if @ctx
  end

  it "should indicate whether it is in a closed state" do
    @dev.should_not be_closed
  end

  it "should retain a reference to its parent context" do
    ctx = @dev.context()
    ctx.should_not be_nil
    ctx.should be_kind_of(Freenect::Context)
    ctx.should == @ctx
  end

  it "should indicate its current tilt state" do
    tilt_state = @dev.tilt_state
    tilt_state.should be_kind_of(Freenect::RawTiltState)
  end

  it "should indicate it's current tilt angle" do
{'fraction_non_alphanumeric': 0.1007845503922752, 'fraction_numerical': 0.0030175015087507543, 'mean_word_length': 3.481081081081081, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2315183', 'n_tokens_mistral': 598, 'n_tokens_neox': 583, 'n_words': 163}