Questions tagged [shoulda]

Shoulda, developed by thoughtbot, provides constructs for organizing Test::Unit tests and matchers for testing Ruby on Rails applications that work with Test::Unit or RSpec.

Shoulda organizes Test::Unit tests into a collection of nested contexts with support for setup and teardown blocks and should clauses. Shoulda also provides matchers for testing Ruby on Rails applications that work with Test::Unit, Minitest or RSpec.

Along with shoulda, thoughtbot provides many many other community libraries.


Resources


Related tags

383 questions
0
votes
2 answers

why can't assign value in it or special block on rspec

I'm newbie on rails and i want to test an existing rails project with rspec,shoulda and factory girl. I try to assign value a variable of a model but i can't. this is the error; Failure/Error: @brief.brand_info = 'bla bla bla' NoMethodError: …
user1609468
  • 113
  • 1
  • 10
0
votes
2 answers

how to test a method of models with rspec and factory

I'm newbie on rails and I have to write tests for existing rails apps with 'Rspec','shoulda' and 'factory girl' gems. I can test non specific tests like validates_presence_of: something with 'sholda' matchers. But I want to test methods which in…
user1609468
  • 113
  • 1
  • 10
0
votes
1 answer

Code works but test fails

I have a test that's failing even though the operation actually works when I test it in the browser. Something wrong with my test, looks like. I'm using Shoulda and fixtures. require 'test_helper' class AddressesControllerTest <…
Ethan
  • 57,819
  • 63
  • 187
  • 237
0
votes
2 answers

rails - how can I show a page's HTML source in the debugger with a request spec?

I've tried p page and p page.source and also: (rdb:1) find ('page') (rdb:1) find ('bosy') (rdb:1) find ('body') (rdb:1) find (rdb:1) p page (rdb:1) p html (rdb:1) p source (rdb:1) p page.source but all I get is variations on: *** Unknown command:…
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
0
votes
1 answer

Shoulda/RSpec: Make sure that validation message "xxx" is on :base

I'm still pretty confused about what is magic behind stuff like it { should have(1).error_on(:base) } and what's a specific Shoulda matcher. I'd like to make sure that :base contains the error message "xxx", so how should I do this? it "should…
Joshua Muheim
  • 12,617
  • 9
  • 76
  • 152
0
votes
0 answers

Using Shoulda to test for an object expecting a method

In the following example the @user.expects(:send_invitations!).once assertion is failing, even though the invitations are being sent by the app and the @send_invitations variable is being assigned. Would you expect @user.send_invitations! to be…
Neil
  • 189
  • 1
  • 1
  • 9
-1
votes
1 answer

undefined method `allow_blank' - ShouldaMatchers

I have simple model that looks like this: class User < ActiveRecord::Base belongs_to :administration validates :administration, presence: true, allow_blank: true end and spec that looks like this: require 'spec_helper' describe User, type:…
Mateusz Urbański
  • 7,352
  • 15
  • 68
  • 133
-1
votes
1 answer

How to do function tests for TWITTER API

I am creating a web app for a project. I want to allow my users to post there blogs onto twitter using the twitter API. they will generate a blog inside my website and if they would like to share their blog via twitter. No so much testing if the…
1 2 3
25
26