Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ jobs:
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
- uses: actions/checkout@v3
- name: Generate lockfile from gemspec
run: bundle lock --add-platform x86_64-linux
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
- name: Check RuboCop version
run: bundle exec rubocop -V
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@

# rspec failure tracking
.rspec_status

Gemfile.lock
.ruby-version
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ require "rubocop/rake_task"

RuboCop::RakeTask.new

task default: %i[spec rubocop steep:check]
task default: %i[steep:check spec rubocop]
2 changes: 1 addition & 1 deletion lib/snapbot/rspec/lets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def collect

def _collect(klass, lets)
lets.tap do
next if klass.to_s == "RSpec::ExampleGroups"
next if klass.to_s == "RSpec::ExampleGroups" # stop when we hit the top

lets.concat(klass::LetDefinitions.instance_methods(false))
parent_class = klass.to_s.deconstantize.constantize
Expand Down
1 change: 1 addition & 0 deletions snapbot.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Gem::Specification.new do |spec|

spec.add_development_dependency "launchy"
spec.add_development_dependency "rbs"
spec.add_development_dependency "rubocop", "~> 1.21"
spec.add_development_dependency "sqlite3"
spec.add_development_dependency "steep"

Expand Down
20 changes: 20 additions & 0 deletions spec/snapbot/rspec/lets_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

RSpec.describe Snapbot::RSpec::Lets do
describe "#collect" do
subject { described_class.new(self).collect }

context "when there are lets" do
let(:foo) { "bar" }
let(:bar) { "baz" }

it { is_expected.to match_array %i[foo bar subject] }
end
end

describe "#collect when there are no lets" do # (cannot use a `subject`, separate describe)
it "returns an empty array" do
expect(described_class.new(self).collect).to be_empty
end
end
end
Loading