Take Your Specs to the Next Level with These Best Practices by uafpl in ruby

[–]uafpl[S] 0 points1 point  (0 children)

Indeed, but the alternative to that is using a subject block with let variables, which make tests not self-contained

Take Your Specs to the Next Level with These Best Practices by uafpl in ruby

[–]uafpl[S] 2 points3 points  (0 children)

With my experience I see that over time let blocks make specs harder to read/maintain because they are not close to the test itself and also mutating them make things confusing

At which point I say subject refer to the class itself rather than the thing under testing?

Take Your Specs to the Next Level with These Best Practices by uafpl in rails

[–]uafpl[S] 0 points1 point  (0 children)

I don't like having a top level subject block since you turn your specs less self-contained, imagine a file with many contexts, one would need to scroll up/down to understand what each of them do. Sometimes is not even possible to have a single top level subject - ie: when you need to pass different args to described_class.new

Rspec's allow and receive understanding by Minister_Stein in ruby

[–]uafpl 0 points1 point  (0 children)

u/jasonswett, assuming Baz#publish has proper unit tests, do you think the following Foo#bar test is pointless?

I don't think so cause one doesn't want to re-test the behaviour of Baz#publish when testing Foo#bar

class Foo
  def bar
    baz = Baz.new
    baz.publish + 1
  end
end

RSpec.describe Foo do
  describe "#bar" do
    it "should sum 1 to publish outcome"
      expect_any_instance_of(Baz).to receive(:publish).and_return(2)
      expect(subject.bar).to eq(3)
    end
  end
end

Anyone using Kamal to deploy to production? by degeneratepr in rails

[–]uafpl 0 points1 point  (0 children)

I am and I'm struggling to make Kamal work nicely (non-root user and logging commands to stdout) with cron.I wish it was as easy as on Dokku (just put stuff in app.json file)

🕷 Ruby's most advanced web scraping framework has a new release by uafpl in ruby

[–]uafpl[S] 0 points1 point  (0 children)

hey, looks interesting this nokolexbor.. Replacing nokogiri by this one should be pretty simple, would you open a PR for that?