title: How does one isolate and test dynamically created classes in rspec
body: <p>How to properly create a new isolated class for each test, using rspec 3.9.0 ?</p>
  
  <p>Here's a test case:</p>
  
  <pre class="lang-rb prettyprint-override"><code>describe 'Dynamic Class Creation' do
  
    it "should have dynamically created class 'One'" do
      class One; end
      expect(One).to be_an_instance_of(Class)
    end
  
    it "should not have class 'One' and raise 'uninitialized constant One' error" do
      expect { One }.to raise_error(an_instance_of(NameError).and having_attributes(message: 'uninitialized constant One'))
    end
  
  end
  </code></pre>