-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from sasamuku/rubcop_and_spec
fix rubcop and spec
- Loading branch information
Showing
5 changed files
with
84 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require "rspec_tree" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# frozen_string_literal: true | ||
|
||
# This file is sample RSpec for test. | ||
|
||
require "sample" | ||
require "sample/example" | ||
|
||
RSpec.describe Sample do # rubocop:disable Metrics/BlockLength | ||
let(:foo) { "foo" } | ||
|
||
before do | ||
# Setup code here | ||
end | ||
|
||
describe "First describe" do | ||
let(:bar) { "bar" } | ||
|
||
context "First context" do | ||
let(:baz) { "baz" } | ||
|
||
it "should do something" do | ||
# Test code here | ||
end | ||
|
||
context "First nested context" do | ||
it "should do something" do | ||
# Test code here | ||
end | ||
end | ||
|
||
it_behaves_like "shared example" | ||
end | ||
end | ||
|
||
describe "Second describe" do | ||
let(:qux) { "qux" } | ||
|
||
context "Second context" do | ||
it "should do something else" do | ||
# Test code here | ||
end | ||
end | ||
end | ||
|
||
shared_examples "shared example" do | ||
it "should behave in a certain way" do | ||
# Test code here | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe RspecTree do | ||
let(:rspec_file) { File.read("spec/data/sample.rb") } | ||
|
||
context "when the version is 0.1.0" do | ||
it "has a version number" do | ||
expect(RspecTree::VERSION).not_to be nil | ||
end | ||
|
||
it "does something useful" do | ||
expect(false).to eq(true) | ||
end | ||
end | ||
|
||
context "when the version is 0.1.1" do | ||
it "has a version number" do | ||
expect(RspecTree::VERSION).not_to be nil | ||
end | ||
describe ".all" do | ||
subject { RspecTree::Tree.all(rspec_file) } | ||
|
||
it "does something useful" do | ||
expect(false).to eq(true) | ||
it "prints all (describe, context, it, etc.)" do | ||
expect { subject }.to output(<<~OUTPUT).to_stdout | ||
desc: Sample | ||
desc: First describe | ||
├──ctx: First context | ||
├────it: should do something | ||
├──ctx: First nested context | ||
├────it: should do something | ||
├────it_behaves_like: shared example | ||
desc: Second describe | ||
├──ctx: Second context | ||
├────it: should do something else | ||
OUTPUT | ||
end | ||
end | ||
end |