Comments (8)
Hi, what's your subject
set to in this spec?
from shoulda-matchers.
At first, I tried with implicit subject, then I've used:
describe Newsletter do
let(:newsletter) { Factory :newsletter }
subject { newsletter } # explicit subject
# ...
it { should serialize(:event_ids).as(Array) }
# ...
end
In both cases, it didn't work. Other tests worked with implicit subject
.
from shoulda-matchers.
What about this?
context "validations" do
subject { Newsletter.new }
it { should serialize(:event_ids).as(Array) }
end
You can also do this:
describe Newsletter do
it "serializes event_ids as an Array" do
Newsletter.new.should serialize(:event_ids).as(Array)
end
end
from shoulda-matchers.
same error :-/
from shoulda-matchers.
Do other matchers work? Like it { should have_many(:whatevers) }
?
from shoulda-matchers.
yes, I have a bunch of these in same file:
describe "associations" do
it { should belong_to(:banner) }
end
describe "number" do
it { should validate_presence_of(:number) }
it { should validate_numericality_of(:number) }
end # number
they all work as expected.
from shoulda-matchers.
I also have this issue (shoulda 3.0.1)
from shoulda-matchers.
This is because the serialize matcher isn't currently in shoulda-matchers 1.0.0 which is the last one released as a gem. If you want to use the serialize matcher now you can do this:
group :test do
gem 'rspec-rails'
gem 'shoulda-matchers', git: "https://github.com/thoughtbot/shoulda-matchers"
gem 'shoulda', '3.0.1'
end
Or wait until we cut the next release of shoulda which should be using the latest shoulda-matchers
from shoulda-matchers.
Related Issues (20)
- Fix intermitent test
- `allow_values` fails to `format_validation_errors` HOT 1
- undefined method `is_in' for <Shoulda::Matchers::ActiveModel::ValidateNumericalityOfMatcher> HOT 2
- Problem when running the tests HOT 7
- Could Not Prove `not_to validate_length_of` Despite Conditional Validation Equally false HOT 3
- Can't be used without Rails and with ActiveModel but not ActiveRecord? HOT 1
- Extend ActiveModel matchers to support arrays attributes HOT 2
- Order of multiple `conditions` qualifier in `have_many` - v5.3.0 HOT 4
- The library doesn't work with frozen-string-literals enabled globally. HOT 1
- Shoulda Matchers ActiveRecord Validate Uniqueness HOT 1
- validation_inclusion_of is returning ArgumentError HOT 1
- Minitest: is there a recommended way to use `shoulda-matchers` without using `shoulda-context` ? HOT 2
- Uniqueness matcher does not account for custom error messages HOT 2
- wrong constant name dummy value on rails 7 HOT 5
- rspec spec/unit fails with ruby 3.3.0dev
- Wrong error with matcher HOT 16
- Cannot validate numericality with dynamic values HOT 2
- Ruby-tests-explorer and shoulda integration HOT 1
- Add `query_constraints` qualifier to the association matcher.
- Numericality matcher not working as expected on 6.0.0 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shoulda-matchers.