Skip to content

Commit

Permalink
Add specs to check for subject compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 20, 2013
1 parent f84b578 commit d75d686
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
4 changes: 1 addition & 3 deletions opal/opal/rspec/browser_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def example_group_started(example_group)
super

@example_group_failed = false
@group_element = Element.new(:li)
@group_element = Element.new(:li, class_name: 'group passed')

description = Element.new(:span, class_name: 'group_description', text: example_group.description)
@group_element << description
Expand All @@ -36,8 +36,6 @@ def example_group_finished(example_group)

if @example_group_failed
@group_element.class_name = 'group failed'
else
@group_element.class_name = 'group passed'
end
end

Expand Down
32 changes: 32 additions & 0 deletions spec/example_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,44 @@ def some_helper
end
end

describe "nested describes" do
it "works in multiple places" do
1.should eq(1)
end

describe "nested" do
it "and here" do
1.should_not eq(2)
end
end
end

describe "subject" do
subject { [1, 2, 3] }

it "a new instance should be the subject" do
subject.should be_kind_of(Array)
end

describe "nested subjects" do
before { subject << 4 }

it "should work with before and example" do
subject.should == [1, 2, 3, 4]
end
end
end

describe Hash do
it "should create a new instance of subject for classes" do
subject.should == {}
end
end

describe [1, 2, 3] do
it "should use a given object as the subject" do
subject.should eq([1, 2, 3])
end
end

describe "Simple expectations" do
Expand Down

0 comments on commit d75d686

Please sign in to comment.