spec/integration/braintree/advanced_search_spec.rb in braintree-3.3.0 vs spec/integration/braintree/advanced_search_spec.rb in braintree-3.4.0
- old
+ new
@@ -4,27 +4,27 @@
before(:each) do
@credit_card = Braintree::Customer.create!(
:credit_card => {
:number => Braintree::Test::CreditCardNumbers::Visa,
:expiration_date => "05/2010"
- }
+ },
).credit_cards[0]
end
context "text_fields" do
it "is" do
id = rand(36**8).to_s(36)
subscription1 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :id => "subscription1_#{id}"
+ :id => "subscription1_#{id}",
).subscription
subscription2 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :id => "subscription2_#{id}"
+ :id => "subscription2_#{id}",
).subscription
collection = Braintree::Subscription.search do |search|
search.id.is "subscription1_#{id}"
end
@@ -37,18 +37,18 @@
id = rand(36**8).to_s(36)
subscription1 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
:price => "11",
- :id => "subscription1_#{id}"
+ :id => "subscription1_#{id}",
).subscription
subscription2 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
:price => "11",
- :id => "subscription2_#{id}"
+ :id => "subscription2_#{id}",
).subscription
collection = Braintree::Subscription.search do |search|
search.id.is_not "subscription1_#{id}"
search.price.is "11"
@@ -61,17 +61,17 @@
it "starts_with" do
id = rand(36**8).to_s(36)
subscription1 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :id => "subscription1_#{id}"
+ :id => "subscription1_#{id}",
).subscription
subscription2 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :id => "subscription2_#{id}"
+ :id => "subscription2_#{id}",
).subscription
collection = Braintree::Subscription.search do |search|
search.id.starts_with "subscription1_"
end
@@ -83,17 +83,17 @@
it "ends_with" do
id = rand(36**8).to_s(36)
subscription1 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :id => "subscription1_#{id}"
+ :id => "subscription1_#{id}",
).subscription
subscription2 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :id => "subscription2_#{id}"
+ :id => "subscription2_#{id}",
).subscription
collection = Braintree::Subscription.search do |search|
search.id.ends_with "1_#{id}"
end
@@ -105,17 +105,17 @@
it "contains" do
id = rand(36**8).to_s(36)
subscription1 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :id => "subscription1_#{id}"
+ :id => "subscription1_#{id}",
).subscription
subscription2 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :id => "subscription2_#{id}"
+ :id => "subscription2_#{id}",
).subscription
collection = Braintree::Subscription.search do |search|
search.id.contains "scription1_"
end
@@ -129,17 +129,17 @@
context "in" do
it "matches all values if none are specified" do
subscription1 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "12"
+ :price => "12",
).subscription
subscription2 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "12"
+ :price => "12",
).subscription
Braintree::Subscription.cancel(subscription2.id)
collection = Braintree::Subscription.search do |search|
@@ -153,17 +153,17 @@
it "returns only matching results" do
subscription1 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "13"
+ :price => "13",
).subscription
subscription2 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "13"
+ :price => "13",
).subscription
Braintree::Subscription.cancel(subscription2.id)
collection = Braintree::Subscription.search do |search|
@@ -177,17 +177,17 @@
it "returns only matching results given an argument list" do
subscription1 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "14"
+ :price => "14",
).subscription
subscription2 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "14"
+ :price => "14",
).subscription
Braintree::Subscription.cancel(subscription2.id)
collection = Braintree::Subscription.search do |search|
@@ -202,17 +202,17 @@
describe "is" do
it "accepts single argument" do
subscription1 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "15"
+ :price => "15",
).subscription
subscription2 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "15"
+ :price => "15",
).subscription
Braintree::Subscription.cancel(subscription2.id)
collection = Braintree::Subscription.search do |search|
@@ -227,17 +227,17 @@
it "returns only matching results given an array" do
subscription1 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "16"
+ :price => "16",
).subscription
subscription2 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "16"
+ :price => "16",
).subscription
Braintree::Subscription.cancel(subscription2.id)
collection = Braintree::Subscription.search do |search|
@@ -264,23 +264,23 @@
describe "in" do
it "works for the in operator" do
subscription1 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "17"
+ :price => "17",
).subscription
subscription2 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "17"
+ :price => "17",
).subscription
subscription3 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::AddOnDiscountPlan[:id],
- :price => "17"
+ :price => "17",
).subscription
plan_ids = [SpecHelper::TriallessPlan[:id], SpecHelper::TrialPlan[:id]]
collection = Braintree::Subscription.search do |search|
search.plan_id.in plan_ids
@@ -305,17 +305,17 @@
describe "is" do
it "returns resource collection with matching results" do
trialless_subscription = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "18"
+ :price => "18",
).subscription
trial_subscription = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "18"
+ :price => "18",
).subscription
collection = Braintree::Subscription.search do |search|
search.plan_id.is SpecHelper::TriallessPlan[:id]
search.price.is "18"
@@ -329,17 +329,17 @@
describe "is_not" do
it "returns resource collection without matching results" do
trialless_subscription = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "19"
+ :price => "19",
).subscription
trial_subscription = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "19"
+ :price => "19",
).subscription
collection = Braintree::Subscription.search do |search|
search.plan_id.is_not SpecHelper::TriallessPlan[:id]
search.price.is "19"
@@ -353,17 +353,17 @@
describe "ends_with" do
it "returns resource collection with matching results" do
trialless_subscription = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "20"
+ :price => "20",
).subscription
trial_subscription = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "20"
+ :price => "20",
).subscription
collection = Braintree::Subscription.search do |search|
search.plan_id.ends_with "trial_plan"
search.price.is "20"
@@ -377,17 +377,17 @@
describe "starts_with" do
it "returns resource collection with matching results" do
trialless_subscription = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "21"
+ :price => "21",
).subscription
trial_subscription = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "21"
+ :price => "21",
).subscription
collection = Braintree::Subscription.search do |search|
search.plan_id.starts_with "integration_trial_p"
search.price.is "21"
@@ -401,17 +401,17 @@
describe "contains" do
it "returns resource collection with matching results" do
trialless_subscription = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "22"
+ :price => "22",
).subscription
trial_subscription = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "22"
+ :price => "22",
).subscription
collection = Braintree::Subscription.search do |search|
search.plan_id.contains "trial_p"
search.price.is "22"
@@ -426,17 +426,17 @@
context "range_field" do
it "is" do
subscription_500 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "5.00"
+ :price => "5.00",
).subscription
subscription_501 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "5.01"
+ :price => "5.01",
).subscription
collection = Braintree::Subscription.search do |search|
search.price.is "5.00"
end
@@ -447,23 +447,23 @@
it "<=" do
subscription_499 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "4.99"
+ :price => "4.99",
).subscription
subscription_500 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "5.00"
+ :price => "5.00",
).subscription
subscription_501 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "5.01"
+ :price => "5.01",
).subscription
collection = Braintree::Subscription.search do |search|
search.price <= "5.00"
end
@@ -475,23 +475,23 @@
it ">=" do
subscription_499 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "999.99"
+ :price => "999.99",
).subscription
subscription_500 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "1000.00"
+ :price => "1000.00",
).subscription
subscription_501 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "1000.01"
+ :price => "1000.01",
).subscription
collection = Braintree::Subscription.search do |search|
search.price >= "1000.00"
end
@@ -503,22 +503,22 @@
it "between" do
subscription_499 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "4.99"
+ :price => "4.99",
).subscription
subscription_500 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
- :price => "5.00"
+ :price => "5.00",
).subscription
subscription_502 = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
- :price => "5.02"
+ :price => "5.02",
).subscription
collection = Braintree::Subscription.search do |search|
search.price.between "4.99", "5.01"
end