Skip to content

Commit

Permalink
Add some simple tests for include/extend in Rspec.configure
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 20, 2013
1 parent 010c01c commit a7b6e17
Showing 1 changed file with 46 additions and 26 deletions.
72 changes: 46 additions & 26 deletions spec/example_spec.rb
Original file line number Diff line number Diff line change
@@ -1,39 +1,29 @@
describe "Adam" do
before do
@bar = 200
end

it "should eat" do
1.should == 1
@bar.should == 200
end

after do
@bar.class
module SomeHelpers
def opal_rspec_helper
let(:defined_opal_helper) { :it_works }
end
end

describe "Benjamin" do
it "likes cream in his tea" do
1.should == 3
module SomeMoreHelpers
def opal_rspec_include_helper
42
end
end

it "should eat bacon" do
"bacon".should be_a_kind_of(String)
end
RSpec.configure do |c|
c.extend SomeHelpers
c.include SomeMoreHelpers
end

describe "Some let tests" do
let(:adam) { 100 }
describe "RSpec include and extend" do
opal_rspec_helper

it "should eat pieee" do
adam.should == 200
it "works for extend" do
defined_opal_helper.should == :it_works
end
end

describe "Normal errors" do
it "should still work" do
raise "wtf son"
it "works for include" do
opal_rspec_include_helper.should == 42
end
end

Expand All @@ -51,3 +41,33 @@
count.should eq(2)
end
end

describe "Simple expectations" do
before do
@bar = 200
end

it "should eat" do
@bar.should == 200
end

after do
@bar.class
end
end

describe "should syntax" do
it "should work for positive" do
[1, 2, 3].should == [1, 2, 3]
end

it "should work for negative" do
[1, 2, 3].should_not == [4, 5, 6]
end
end

describe "Normal errors" do
it "should still work" do
lambda { raise "wtf son" }.should raise_error(Exception)
end
end

0 comments on commit a7b6e17

Please sign in to comment.